Elin Modding Docs Doc
Loading...
Searching...
No Matches
AM_MoveInstalled.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x0200014A RID: 330
6public class AM_MoveInstalled : AM_Designation<TaskMoveInstalled>
7{
8 // Token: 0x06000981 RID: 2433 RVA: 0x0003A744 File Offset: 0x00038944
9 public override bool IsRoofEditMode(Card c = null)
10 {
11 return ActionMode.Build._IsRoofEditMode(this.target);
12 }
13
14 // Token: 0x1700024A RID: 586
15 // (get) Token: 0x06000982 RID: 2434 RVA: 0x0003A756 File Offset: 0x00038956
16 public override int hitW
17 {
18 get
19 {
20 if (this.target != null)
21 {
22 return this.moldCard.W;
23 }
24 return 1;
25 }
26 }
27
28 // Token: 0x1700024B RID: 587
29 // (get) Token: 0x06000983 RID: 2435 RVA: 0x0003A76D File Offset: 0x0003896D
30 public override int hitH
31 {
32 get
33 {
34 if (this.target != null)
35 {
36 return this.moldCard.H;
37 }
38 return 1;
39 }
40 }
41
42 // Token: 0x1700024C RID: 588
43 // (get) Token: 0x06000984 RID: 2436 RVA: 0x0003A784 File Offset: 0x00038984
44 public override int CostMoney
45 {
46 get
47 {
48 if (this.target != null)
49 {
50 return 0;
51 }
52 return 0;
53 }
54 }
55
56 // Token: 0x1700024D RID: 589
57 // (get) Token: 0x06000985 RID: 2437 RVA: 0x0003A791 File Offset: 0x00038991
58 public override BaseTileMap.CardIconMode cardIconMode
59 {
60 get
61 {
62 return BaseTileMap.CardIconMode.Inspect;
63 }
64 }
65
66 // Token: 0x06000986 RID: 2438 RVA: 0x0003A794 File Offset: 0x00038994
67 public override HitResult HitResultOnDesignation(Point p)
68 {
69 return HitResult.Invalid;
70 }
71
72 // Token: 0x1700024E RID: 590
73 // (get) Token: 0x06000987 RID: 2439 RVA: 0x0003A797 File Offset: 0x00038997
74 public override bool AllowMiddleClickFunc
75 {
76 get
77 {
78 return this.target == null;
79 }
80 }
81
82 // Token: 0x1700024F RID: 591
83 // (get) Token: 0x06000988 RID: 2440 RVA: 0x0003A7A2 File Offset: 0x000389A2
84 public bool FreePos
85 {
86 get
87 {
88 return EClass.game.config.FreePos;
89 }
90 }
91
92 // Token: 0x17000250 RID: 592
93 // (get) Token: 0x06000989 RID: 2441 RVA: 0x0003A7B3 File Offset: 0x000389B3
94 public override BaseTileSelector.SelectType selectType
95 {
96 get
97 {
98 return BaseTileSelector.SelectType.Single;
99 }
100 }
101
102 // Token: 0x17000251 RID: 593
103 // (get) Token: 0x0600098A RID: 2442 RVA: 0x0003A7B6 File Offset: 0x000389B6
104 public override bool ShouldHideBuildMenu
105 {
106 get
107 {
108 return this.target != null;
109 }
110 }
111
112 // Token: 0x0600098B RID: 2443 RVA: 0x0003A7C1 File Offset: 0x000389C1
113 public override bool CanInstaComplete(TaskMoveInstalled t)
114 {
115 return EClass.player.instaComplete;
116 }
117
118 // Token: 0x0600098C RID: 2444 RVA: 0x0003A7CD File Offset: 0x000389CD
119 public override MeshPass GetGuidePass(Point point)
120 {
121 return EClass.screen.guide.passGuideBlock;
122 }
123
124 // Token: 0x0600098D RID: 2445 RVA: 0x0003A7DE File Offset: 0x000389DE
125 public void Activate(Thing t)
126 {
127 base.Activate(true, false);
128 this.SetTarget(t);
129 this.onetime = true;
130 EClass.ui.hud.hint.UpdateText();
131 }
132
133 // Token: 0x0600098E RID: 2446 RVA: 0x0003A80C File Offset: 0x00038A0C
134 public override void OnActivate()
135 {
136 this.onetime = false;
137 this.list = base.Designations.moveInstalled;
138 this.target = (this.moldCard = null);
139 base.OnActivate();
140 }
141
142 // Token: 0x0600098F RID: 2447 RVA: 0x0003A848 File Offset: 0x00038A48
143 public override void OnDeactivate()
144 {
145 this.target = (this.moldCard = (this.mold.target = null));
146 }
147
148 // Token: 0x06000990 RID: 2448 RVA: 0x0003A873 File Offset: 0x00038A73
149 public override void OnCreateMold(bool processing)
150 {
151 this.mold.target = this.target;
152 }
153
154 // Token: 0x06000991 RID: 2449 RVA: 0x0003A888 File Offset: 0x00038A88
155 public override HitResult HitTest(Point point, Point start)
156 {
157 if (EClass.debug.enable)
158 {
159 int hotkey = EInput.hotkey;
160 if (hotkey != 0)
161 {
162 if (hotkey == 1)
163 {
164 EClass._map.AddDecal(point.x, point.z, 2, 1, true);
165 }
166 }
167 else
168 {
169 EClass._map.SetDecal(point.x, point.z, 0, 1, true);
170 }
171 }
172 if (this.target == null)
173 {
174 if (EClass.scene.mouseTarget.CanCycle())
175 {
176 return HitResult.Warning;
177 }
178 if (this.GetTarget(point) != null)
179 {
180 return HitResult.Valid;
181 }
182 return HitResult.Default;
183 }
184 else
185 {
186 if (this.target.isChara && this.CheckEnemyNearBy(this.target, point, false))
187 {
188 return HitResult.Invalid;
189 }
190 this.moldCard.ignoreStackHeight = Input.GetKey(KeyCode.LeftControl);
191 if (!EClass.debug.ignoreBuildRule)
192 {
193 if (this.target.isChara && (point.IsBlocked || point.HasChara))
194 {
195 return HitResult.Invalid;
196 }
197 if (!EClass._map.bounds.Contains(point))
198 {
199 return HitResult.Invalid;
200 }
201 }
202 return base.HitTest(point, start);
203 }
204 }
205
206 // Token: 0x06000992 RID: 2450 RVA: 0x0003A988 File Offset: 0x00038B88
207 public void SetTarget(Card _target)
208 {
209 foreach (TaskMoveInstalled taskMoveInstalled in EClass._map.tasks.designations.moveInstalled.items.ToArray())
210 {
211 if (taskMoveInstalled.target == _target)
212 {
213 taskMoveInstalled.Destroy();
214 }
215 }
216 this.mold.target = _target;
217 this.target = _target;
218 if (this.target.isThing)
219 {
220 this.moldCard = this.target.Duplicate(1);
221 this.moldCard.placeState = PlaceState.installed;
222 }
223 else
224 {
225 this.moldCard = CharaGen.Create(_target.id, -1);
226 this.moldCard.idSkin = this.target.idSkin;
227 }
228 EClass.ui.hud.hint.UpdateText();
229 }
230
231 // Token: 0x06000993 RID: 2451 RVA: 0x0003AA54 File Offset: 0x00038C54
232 public Card GetTarget(Point point)
233 {
234 return EClass.scene.mouseTarget.card;
235 }
236
237 // Token: 0x06000994 RID: 2452 RVA: 0x0003AA65 File Offset: 0x00038C65
238 public bool CanPutAway()
239 {
240 return EClass.debug.ignoreBuildRule || (this.target != null && !this.target.isChara && !this.target.trait.CanOnlyCarry);
241 }
242
243 // Token: 0x06000995 RID: 2453 RVA: 0x0003AAA0 File Offset: 0x00038CA0
244 public bool TryPutAway()
245 {
246 if (!this.CanPutAway())
247 {
248 return false;
249 }
250 if (!EClass._map.PutAway(this.target))
251 {
252 SE.Beep();
253 return false;
254 }
255 SE.Click();
256 this.target = null;
257 EClass.ui.hud.hint.UpdateText();
258 return true;
259 }
260
261 // Token: 0x06000996 RID: 2454 RVA: 0x0003AAF4 File Offset: 0x00038CF4
262 public bool CheckEnemyNearBy(Card t, Point p, bool msg = true)
263 {
264 if (t.isChara && !EClass.debug.ignoreBuildRule)
265 {
266 bool flag = true;
267 foreach (Chara chara in EClass._map.charas)
268 {
269 if (chara.hostility <= Hostility.Enemy && chara.Dist(p) <= 6)
270 {
271 flag = false;
272 }
273 }
274 if (!flag)
275 {
276 if (msg)
277 {
278 SE.BeepSmall();
279 EClass.ui.Say("enemyInMap".langGame(), null);
280 }
281 return true;
282 }
283 }
284 return false;
285 }
286
287 // Token: 0x06000997 RID: 2455 RVA: 0x0003AB94 File Offset: 0x00038D94
288 public override void OnProcessTiles(Point point, int dir)
289 {
290 if (this.target == null)
291 {
292 Card t = this.GetTarget(point);
293 if (this.CheckEnemyNearBy(t, t.pos, true))
294 {
295 return;
296 }
297 if (t.trait.ShowContextOnPick)
298 {
299 ActPlan actPlan = new ActPlan
300 {
301 pos = point.Copy(),
302 ignoreAdddCondition = true,
303 input = ActInput.AllAction,
304 altAction = true
305 };
306 t.trait.TrySetAct(actPlan);
307 if (actPlan.list.Count > 0)
308 {
309 UIContextMenu uicontextMenu = EClass.ui.CreateContextMenuInteraction();
310 uicontextMenu.AddButton("move", delegate()
311 {
312 this.SetTarget(t);
313 SE.Click();
314 }, true);
315 using (List<ActPlan.Item>.Enumerator enumerator = actPlan.list.GetEnumerator())
316 {
317 while (enumerator.MoveNext())
318 {
319 ActPlan.Item i = enumerator.Current;
320 uicontextMenu.AddButton(i.GetTextContext(false), delegate()
321 {
322 i.act.Perform();
323 }, true);
324 }
325 }
326 uicontextMenu.Show();
327 return;
328 }
329 }
330 this.SetTarget(t);
331 SE.Click();
332 return;
333 }
334 else
335 {
336 if (this.CheckEnemyNearBy(this.target, point, true))
337 {
338 return;
339 }
340 this.mold.dir = this.moldCard.dir;
341 this.mold.altitude = this.moldCard.altitude;
342 if (this.target.isChara)
343 {
344 Point orgPos = this.target.Chara.orgPos;
345 if (orgPos != null)
346 {
347 orgPos.Set(point);
348 }
349 }
350 base.OnProcessTiles(point, dir);
351 this.target.ignoreStackHeight = this.moldCard.ignoreStackHeight;
352 this.target.freePos = this.moldCard.freePos;
353 this.target.fx = (this.FreePos ? this.moldCard.fx : 0f);
354 this.target.fy = (this.FreePos ? this.moldCard.fy : 0f);
355 if (this.target.isChara && EClass.debug)
356 {
357 foreach (Thing thing in point.Things)
358 {
359 TraitShackle traitShackle = thing.trait as TraitShackle;
360 if (traitShackle != null)
361 {
362 traitShackle.Restrain(this.target.Chara, false);
363 }
364 }
365 }
366 if (this.target.isThing)
367 {
368 this.target.isRoofItem = this.IsRoofEditMode(null);
369 if (this.target.isRoofItem)
370 {
371 this.target.SetPlaceState(PlaceState.roaming, false);
372 }
373 }
374 SE.Click();
375 if (this.target.renderer.hasActor)
376 {
377 this.target.renderer.RefreshSprite();
378 }
379 this.target = null;
380 return;
381 }
382 }
383
384 // Token: 0x06000998 RID: 2456 RVA: 0x0003AEB0 File Offset: 0x000390B0
385 public unsafe override void OnRenderTile(Point point, HitResult result, int dir)
386 {
387 if (this.target == null)
388 {
389 Card card = this.GetTarget(point);
390 if (card != null && card.isThing)
391 {
392 card.Thing.RenderMarker(point, true, result, true, -1, true);
393 }
394 base.OnRenderTile(point, (result == HitResult.Valid) ? (EClass.scene.mouseTarget.CanCycle() ? HitResult.Warning : HitResult.Default) : result, dir);
395 return;
396 }
397 if (this.moldCard == null)
398 {
399 base.OnRenderTile(point, result, dir);
400 return;
401 }
402 this.moldCard.SetFreePos(point);
403 if (result != HitResult.Valid && result != HitResult.Warning)
404 {
405 base.OnRenderTile(point, result, dir);
406 }
407 else
408 {
409 int desiredDir = this.target.TileType.GetDesiredDir(point, this.moldCard.dir);
410 if (desiredDir != -1)
411 {
412 dir = (this.moldCard.dir = desiredDir);
413 }
414 bool flag = !base.tileSelector.multisize || (base.tileSelector.firstInMulti && base.Summary.count == base.Summary.countValid);
415 this.moldCard.RenderMarker(point, false, result, flag, -1, false);
416 if (flag)
417 {
418 this.target.trait.OnRenderTile(point, result, dir);
419 }
420 }
421 EClass.screen.guide.DrawLine(*this.target.pos.PositionCenter(), *point.PositionCenter());
422 }
423
424 // Token: 0x06000999 RID: 2457 RVA: 0x0003B003 File Offset: 0x00039203
425 public override void RotateUnderMouse()
426 {
427 if (this.target != null)
428 {
429 SE.Rotate();
430 this.moldCard.Rotate(false);
431 return;
432 }
433 base.RotateUnderMouse();
434 }
435
436 // Token: 0x0600099A RID: 2458 RVA: 0x0003B028 File Offset: 0x00039228
437 public override void InputWheel(int wheel)
438 {
439 if (EInput.isAltDown || EInput.isCtrlDown)
440 {
441 return;
442 }
443 if (this.target != null && this.target.TileType.MaxAltitude > 0)
444 {
445 this.moldCard.ChangeAltitude(wheel);
446 return;
447 }
448 if (EClass.scene.mouseTarget.CanCycle())
449 {
450 EClass.scene.mouseTarget.CycleTarget(wheel);
451 return;
452 }
453 base.InputWheel(wheel);
454 }
455
456 // Token: 0x0600099B RID: 2459 RVA: 0x0003B095 File Offset: 0x00039295
457 public override void OnCancel()
458 {
459 if (this.target != null)
460 {
461 this.target = null;
462 if (this.onetime)
463 {
464 base.OnCancel();
465 }
466 return;
467 }
468 base.OnCancel();
469 }
470
471 // Token: 0x0600099C RID: 2460 RVA: 0x0003B0BB File Offset: 0x000392BB
472 public override void OnFinishProcessTiles()
473 {
474 if (this.onetime)
475 {
476 base.Deactivate();
477 }
478 }
479
480 // Token: 0x040008EF RID: 2287
481 public Card target;
482
483 // Token: 0x040008F0 RID: 2288
484 public Card moldCard;
485
486 // Token: 0x040008F1 RID: 2289
487 public bool onetime;
488}
Definition Card.cs:13
Definition Chara.cs:12
Definition Point.cs:11
Definition Thing.cs:10