9 public override bool IsRoofEditMode(
Card c =
null)
11 return ActionMode.Build._IsRoofEditMode(this.target);
16 public override int hitW
20 if (this.target !=
null)
22 return this.moldCard.W;
30 public override int hitH
34 if (this.target !=
null)
36 return this.moldCard.H;
44 public override int CostMoney
48 if (this.target !=
null)
58 public override BaseTileMap.CardIconMode cardIconMode
67 public override HitResult HitResultOnDesignation(
Point p)
69 return HitResult.Invalid;
74 public override bool AllowMiddleClickFunc
78 return this.target ==
null;
88 return EClass.game.config.FreePos;
94 public override BaseTileSelector.SelectType selectType
104 public override bool ShouldHideBuildMenu
108 return this.target !=
null;
115 return EClass.player.instaComplete;
121 return EClass.screen.guide.passGuideBlock;
125 public void Activate(
Thing t)
127 base.Activate(
true,
false);
130 EClass.ui.hud.hint.UpdateText();
134 public override void OnActivate()
136 this.onetime =
false;
137 this.list = base.Designations.moveInstalled;
138 this.target = (this.moldCard =
null);
143 public override void OnDeactivate()
145 this.target = (this.moldCard = (this.mold.target =
null));
149 public override void OnCreateMold(
bool processing)
151 this.mold.target = this.target;
155 public override HitResult HitTest(
Point point,
Point start)
159 int hotkey = EInput.hotkey;
164 EClass._map.AddDecal(point.x, point.z, 2, 1,
true);
169 EClass._map.SetDecal(point.x, point.z, 0, 1,
true);
172 if (this.target ==
null)
174 if (
EClass.scene.mouseTarget.CanCycle())
176 return HitResult.Warning;
178 if (this.GetTarget(point) !=
null)
180 return HitResult.Valid;
182 return HitResult.Default;
186 if (this.target.isChara &&
this.CheckEnemyNearBy(
this.target, point,
false))
188 return HitResult.Invalid;
190 this.moldCard.ignoreStackHeight = Input.GetKey(KeyCode.LeftControl);
191 if (!
EClass.debug.ignoreBuildRule)
193 if (this.target.isChara && (point.IsBlocked || point.HasChara))
195 return HitResult.Invalid;
197 if (!
EClass._map.bounds.Contains(point))
199 return HitResult.Invalid;
202 return base.HitTest(point, start);
207 public void SetTarget(
Card _target)
211 if (taskMoveInstalled.target == _target)
213 taskMoveInstalled.Destroy();
216 this.mold.target = _target;
217 this.target = _target;
218 if (this.target.isThing)
220 this.moldCard = this.target.Duplicate(1);
221 this.moldCard.placeState = PlaceState.installed;
225 this.moldCard =
CharaGen.Create(_target.id, -1);
226 this.moldCard.idSkin = this.target.idSkin;
228 EClass.ui.hud.hint.UpdateText();
234 return EClass.scene.mouseTarget.card;
238 public bool CanPutAway()
240 return EClass.debug.ignoreBuildRule || (this.target !=
null && !this.target.isChara && !this.target.trait.CanOnlyCarry);
244 public bool TryPutAway()
246 if (!this.CanPutAway())
250 if (!
EClass._map.PutAway(
this.target))
257 EClass.ui.hud.hint.UpdateText();
262 public bool CheckEnemyNearBy(
Card t,
Point p,
bool msg =
true)
264 if (t.isChara && !
EClass.debug.ignoreBuildRule)
269 if (chara.hostility <= Hostility.Enemy && chara.Dist(p) <= 6)
279 EClass.ui.Say(
"enemyInMap".langGame(),
null);
288 public override void OnProcessTiles(
Point point,
int dir)
290 if (this.target ==
null)
292 Card t = this.GetTarget(point);
293 if (this.CheckEnemyNearBy(t, t.pos,
true))
297 if (t.trait.ShowContextOnPick)
302 ignoreAdddCondition =
true,
303 input = ActInput.AllAction,
306 t.trait.TrySetAct(actPlan);
307 if (actPlan.list.Count > 0)
309 UIContextMenu uicontextMenu =
EClass.ui.CreateContextMenuInteraction();
310 uicontextMenu.AddButton(
"move", delegate()
315 using (List<
ActPlan.
Item>.Enumerator enumerator = actPlan.list.GetEnumerator())
317 while (enumerator.MoveNext())
320 uicontextMenu.AddButton(i.GetTextContext(
false), delegate()
326 uicontextMenu.Show();
336 if (this.CheckEnemyNearBy(this.target, point,
true))
340 this.mold.dir = this.moldCard.dir;
341 this.mold.altitude = this.moldCard.altitude;
342 if (this.target.isChara)
344 Point orgPos = this.target.Chara.orgPos;
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)
357 foreach (
Thing thing
in point.Things)
360 if (traitShackle !=
null)
362 traitShackle.Restrain(this.target.Chara,
false);
366 if (this.target.isThing)
368 this.target.isRoofItem = this.IsRoofEditMode(
null);
369 if (this.target.isRoofItem)
371 this.target.SetPlaceState(PlaceState.roaming,
false);
375 if (this.target.renderer.hasActor)
377 this.target.renderer.RefreshSprite();
385 public unsafe
override void OnRenderTile(
Point point, HitResult result,
int dir)
387 if (this.target ==
null)
389 Card card = this.GetTarget(point);
390 if (card !=
null && card.isThing)
392 card.Thing.RenderMarker(point,
true, result,
true, -1,
true);
394 base.OnRenderTile(point, (result == HitResult.Valid) ? (
EClass.scene.mouseTarget.CanCycle() ? HitResult.Warning : HitResult.Default) : result, dir);
397 if (this.moldCard ==
null)
399 base.OnRenderTile(point, result, dir);
402 this.moldCard.SetFreePos(point);
403 if (result != HitResult.Valid && result != HitResult.Warning)
405 base.OnRenderTile(point, result, dir);
409 int desiredDir = this.target.TileType.GetDesiredDir(point, this.moldCard.dir);
410 if (desiredDir != -1)
412 dir = (this.moldCard.dir = desiredDir);
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);
418 this.target.trait.OnRenderTile(point, result, dir);
421 EClass.screen.guide.DrawLine(*this.target.pos.PositionCenter(), *point.PositionCenter());
425 public override void RotateUnderMouse()
427 if (this.target !=
null)
430 this.moldCard.Rotate(
false);
433 base.RotateUnderMouse();
437 public override void InputWheel(
int wheel)
439 if (EInput.isAltDown || EInput.isCtrlDown)
443 if (this.target !=
null && this.target.TileType.MaxAltitude > 0)
445 this.moldCard.ChangeAltitude(wheel);
448 if (
EClass.scene.mouseTarget.CanCycle())
450 EClass.scene.mouseTarget.CycleTarget(wheel);
453 base.InputWheel(wheel);
457 public override void OnCancel()
459 if (this.target !=
null)
472 public override void OnFinishProcessTiles()
484 public Card moldCard;