Elin Modding Docs Doc
Loading...
Searching...
No Matches
TaskMine.cs
1using System;
2
3// Token: 0x02000256 RID: 598
5{
6 // Token: 0x17000470 RID: 1136
7 // (get) Token: 0x060010AD RID: 4269 RVA: 0x0007415A File Offset: 0x0007235A
8 public override BaseTaskHarvest.HarvestType harvestType
9 {
10 get
11 {
12 return BaseTaskHarvest.HarvestType.Block;
13 }
14 }
15
16 // Token: 0x17000471 RID: 1137
17 // (get) Token: 0x060010AE RID: 4270 RVA: 0x0007415D File Offset: 0x0007235D
18 public override int destDist
19 {
20 get
21 {
22 return 1;
23 }
24 }
25
26 // Token: 0x17000472 RID: 1138
27 // (get) Token: 0x060010AF RID: 4271 RVA: 0x00074160 File Offset: 0x00072360
28 public override bool isBlock
29 {
30 get
31 {
32 return true;
33 }
34 }
35
36 // Token: 0x17000473 RID: 1139
37 // (get) Token: 0x060010B0 RID: 4272 RVA: 0x00074163 File Offset: 0x00072363
38 public override int RightHand
39 {
40 get
41 {
42 return 1004;
43 }
44 }
45
46 // Token: 0x17000474 RID: 1140
47 // (get) Token: 0x060010B1 RID: 4273 RVA: 0x0007416A File Offset: 0x0007236A
48 public override bool destIgnoreConnection
49 {
50 get
51 {
52 return true;
53 }
54 }
55
56 // Token: 0x17000475 RID: 1141
57 // (get) Token: 0x060010B2 RID: 4274 RVA: 0x0007416D File Offset: 0x0007236D
58 public override bool ShowMapHighlightBlock
59 {
60 get
61 {
62 return true;
63 }
64 }
65
66 // Token: 0x17000476 RID: 1142
67 // (get) Token: 0x060010B3 RID: 4275 RVA: 0x00074170 File Offset: 0x00072370
68 public override CursorInfo CursorIcon
69 {
70 get
71 {
72 return CursorSystem.Mine;
73 }
74 }
75
76 // Token: 0x17000477 RID: 1143
77 // (get) Token: 0x060010B4 RID: 4276 RVA: 0x00074177 File Offset: 0x00072377
78 public override bool IsHostileAct
79 {
80 get
81 {
82 return true;
83 }
84 }
85
86 // Token: 0x060010B5 RID: 4277 RVA: 0x0007417C File Offset: 0x0007237C
87 public static bool CanMine(Point pos, Card t)
88 {
89 if (t != null && pos.HasBlock && (!pos.HasObj || !pos.sourceObj.tileType.IsBlockMount))
90 {
91 if (t.HasElement(220, 1))
92 {
93 return true;
94 }
95 if ((pos.matBlock.category == "wood" || pos.matBlock.category == "grass") && t.HasElement(225, 1))
96 {
97 return true;
98 }
99 }
100 return false;
101 }
102
103 // Token: 0x060010B6 RID: 4278 RVA: 0x000741FD File Offset: 0x000723FD
104 public override string GetTextSmall(Card c)
105 {
106 if (!this.pos.cell.HasBlock)
107 {
108 return this.pos.cell.GetFloorName();
109 }
110 return this.pos.cell.GetBlockName();
111 }
112
113 // Token: 0x060010B7 RID: 4279 RVA: 0x00074234 File Offset: 0x00072434
114 public override void OnCreateProgress(Progress_Custom p)
115 {
116 base.SetTarget(this.owner, null);
117 p.textHint = this.pos.cell.GetBlockName();
118 p.maxProgress = this.maxProgress;
119 p.onProgressBegin = delegate()
120 {
121 if (!TaskMine.CanMine(this.pos, this.owner.Tool))
122 {
123 p.Cancel();
124 return;
125 }
126 if (this.IsTooHard)
127 {
128 this.owner.Say("tooHardToMine", this.owner, this.pos.cell.GetBlockName(), null);
129 p.Cancel();
130 return;
131 }
132 if (this.owner.Tool != null)
133 {
134 this.owner.Say("mine_start", this.owner, this.owner.Tool, null, null);
135 }
136 };
137 p.onProgress = delegate(Progress_Custom _p)
138 {
139 this.owner.LookAt(this.pos);
140 this.owner.PlaySound(this.pos.matBlock.GetSoundImpact(null), 1f, true);
141 this.pos.Animate(AnimeID.HitObj, true);
142 this.pos.matBlock.PlayHitEffect(this.pos);
143 this.pos.matBlock.AddBlood(this.pos, 1);
144 this.owner.renderer.NextFrame();
145 this.owner.elements.ModExp(220, 5, false);
146 if (EClass._zone.IsCrime(this.owner, this))
147 {
148 this.owner.pos.TryWitnessCrime(this.owner, null, 4, null);
149 }
150 };
151 }
152
153 // Token: 0x060010B8 RID: 4280 RVA: 0x000742BC File Offset: 0x000724BC
154 public override void DrawMarker(int x, int z, RenderParam p)
155 {
156 if (ActionMode.Mine.IsRoofEditMode(null) && this.pos.HasWallOrFence)
157 {
158 EClass.screen.guide.DrawWall(this.pos, this.Working ? EClass.Colors.blockColors.ActiveOpacity : EClass.Colors.blockColors.InactiveOpacity, false, 0f);
159 return;
160 }
161 base.DrawMarker(x, z, p);
162 }
163
164 // Token: 0x060010B9 RID: 4281 RVA: 0x00074330 File Offset: 0x00072530
165 public override HitResult GetHitResult()
166 {
167 if (ActionMode.Mine.IsRoofEditMode(null))
168 {
169 if (this.pos.cell._roofBlock == 0)
170 {
171 return HitResult.Default;
172 }
173 return HitResult.Valid;
174 }
175 else if (this.pos.cell.HasBlock || !this.pos.cell.isSeen)
176 {
177 if (this.pos.sourceBlock.tileType.Invisible && !ActionMode.Mine.IsActive)
178 {
179 return HitResult.Default;
180 }
181 if (this.mode == TaskMine.Mode.Ramp && (this.pos.cell.HasRamp || EClass._map.GetRampDir(this.pos.x, this.pos.z, EClass.sources.blocks.rows[this.ramp].tileType) == -1))
182 {
183 return HitResult.Default;
184 }
185 return HitResult.Valid;
186 }
187 else
188 {
189 if (!this.mined && !this.pos.HasObj && this.owner != null && !this.owner.IsAgent && this.pos.Equals(this.owner.pos) && this.pos.Installed == null && EClass._zone.CanDigUnderground)
190 {
191 return HitResult.Valid;
192 }
193 return HitResult.Default;
194 }
195 }
196
197 // Token: 0x060010BA RID: 4282 RVA: 0x0007446C File Offset: 0x0007266C
198 public override void OnProgressComplete()
199 {
200 string recipeID = this.pos.sourceBlock.RecipeID;
201 TaskMine.Mode mode = this.mode;
202 if (mode != TaskMine.Mode.Default)
203 {
204 if (mode == TaskMine.Mode.Ramp)
205 {
206 EClass._map.MineRamp(this.pos, (this.ramp == 3) ? this.pos.matBlock.ramp : this.ramp, false);
207 }
208 }
209 else if (this.pos.HasBlock || ActionMode.Mine.IsRoofEditMode(null))
210 {
211 if (this.owner.IsPC)
212 {
213 EClass.player.stats.digs++;
214 }
215 EClass._map.MineBlock(this.pos, false, this.owner);
216 }
217 else if (this.pos.Installed == null)
218 {
219 EClass._zone.AddThing("stairsDown_cave", this.pos.x, this.pos.z).Install();
220 return;
221 }
222 if (!this.owner.IsAgent)
223 {
224 this.owner.elements.ModExp(220, 50, false);
225 if (EClass.rnd(10) == 0)
226 {
227 EClass._map.TrySmoothPick(this.pos, ThingGen.Create("pebble", -1, -1), this.owner);
228 }
229 if (EClass.rnd(10) == 0)
230 {
231 EClass._map.TrySmoothPick(this.pos, ThingGen.Create("stone", -1, -1), this.owner);
232 }
233 if (EClass._zone.IsCrime(this.owner, this))
234 {
235 EClass.player.ModKarma(-1);
236 }
237 if (EClass.rnd(2) == 0)
238 {
239 this.owner.stamina.Mod(-1);
240 }
241 }
242 if (this.owner != null && this.owner.IsPC)
243 {
244 EClass.player.recipes.ComeUpWithRecipe(recipeID, 30);
245 }
246 this.mined = true;
247 }
248
249 // Token: 0x04000DC8 RID: 3528
250 public TaskMine.Mode mode;
251
252 // Token: 0x04000DC9 RID: 3529
253 public int ramp = 3;
254
255 // Token: 0x04000DCA RID: 3530
256 public bool mined;
257
258 // Token: 0x0200092F RID: 2351
259 public enum Mode
260 {
261 // Token: 0x040026D5 RID: 9941
262 Default,
263 // Token: 0x040026D6 RID: 9942
264 Ramp
265 }
266}
Definition Card.cs:13
Definition Point.cs:11