Elin Decompiled Documentation EA 23.255 Nightly Patch 3
Loading...
Searching...
No Matches
TraitFakeTile.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2
3public class TraitFakeTile : Trait
4{
5 public override TileMode tileMode => TileMode.FakeBlock;
6
7 public override RenderData GetRenderData()
8 {
9 return EClass.sources.blocks.map[owner.refVal].renderData;
10 }
11
12 public override SourcePref GetPref()
13 {
15 if (!(tileType is TileTypePillar))
16 {
17 if (!(tileType is TileTypeFence))
18 {
19 if (!(tileType is TileTypeStairs))
20 {
21 if (!(tileType is TileTypeWall))
22 {
24 {
26 }
27 return null;
28 }
30 }
32 }
34 }
36 }
37
38 public override void OnCrafted(Recipe recipe, List<Thing> ings)
39 {
40 owner.refVal = 0;
41 if (this is TraitFakeBlock && ings != null && ings.Count > 0)
42 {
43 TraitBlock traitBlock = ings[0].trait as TraitBlock;
44 owner.refVal = traitBlock.source.id;
45 }
46 }
47
48 public override void TrySetHeldAct(ActPlan p)
49 {
50 if (this is TraitFakeBlock)
51 {
52 if (p.pos.cell._block == 0)
53 {
54 return;
55 }
56 }
57 else if (p.pos.cell.obj == 0)
58 {
59 return;
60 }
61 TileRow source = ((this is TraitFakeBlock) ? ((TileRow)p.pos.sourceBlock) : ((TileRow)p.pos.sourceObj));
63 if (!source.ContainsTag("noFake"))
64 {
65 p.TrySetAct("actCopyBlock", delegate
66 {
67 owner.Dye(mat);
68 owner.refVal = source.id;
69 SE.Play("offering");
71 HotItemHeld.recipe = GetRecipe();
73 return false;
74 });
75 }
76 }
77}
Point pos
Definition: ActPlan.cs:150
bool TrySetAct(string lang, Func< bool > onPerform, Card tc, CursorInfo cursor=null, int dist=1, bool isHostileAct=false, bool localAct=true, bool canRepeat=false)
Definition: ActPlan.cs:366
virtual CardRenderer _CreateRenderer()
Definition: Card.cs:5988
void Dye(string idMat)
Definition: Card.cs:6026
int refVal
Definition: Card.cs:206
virtual Thing Thing
Definition: Card.cs:2058
byte _block
Definition: Cell.cs:30
SourceMaterial.Row matObj
Definition: Cell.cs:1036
byte obj
Definition: Cell.cs:38
SourcePref blockWall
Definition: CoreRef.cs:336
SourcePref blockPillar
Definition: CoreRef.cs:338
SourcePref blockFence
Definition: CoreRef.cs:332
SourcePref blockStairs
Definition: CoreRef.cs:334
PrefData prefs
Definition: CoreRef.cs:415
CoreRef refs
Definition: Core.cs:51
Definition: EClass.cs:6
static Core core
Definition: EClass.cs:7
static SourceManager sources
Definition: EClass.cs:43
static void SetDirty(Thing t)
SourceMaterial.Row matBlock
Definition: Point.cs:55
SourceBlock.Row sourceBlock
Definition: Point.cs:63
SourceObj.Row sourceObj
Definition: Point.cs:69
Cell cell
Definition: Point.cs:51
Definition: Recipe.cs:7
bool ContainsTag(string _tag)
Definition: RenderRow.cs:148
SourceBlock blocks
int id
Definition: TileRow.cs:8
override TileRow source
Definition: TraitBlock.cs:3
override SourcePref GetPref()
override TileMode tileMode
Definition: TraitFakeTile.cs:5
override void OnCrafted(Recipe recipe, List< Thing > ings)
override void TrySetHeldAct(ActPlan p)
override RenderData GetRenderData()
Definition: TraitFakeTile.cs:7
Definition: Trait.cs:7
virtual Recipe GetRecipe()
Definition: Trait.cs:820
virtual TileType tileType
Definition: Trait.cs:50
TileMode
Definition: Trait.cs:9
Card owner
Definition: Trait.cs:28