8 public bool _IsRoofEditMode(
Card c)
10 return Input.GetKey(KeyCode.LeftAlt) && (c ==
null || !c.trait.CanOnlyCarry);
14 public override bool IsRoofEditMode(
Card c =
null)
16 Recipe recipe = this.recipe;
17 return this._IsRoofEditMode((recipe !=
null) ? recipe.Mold :
null);
21 public override bool IsFillMode()
23 return !this.recipe.IsThing && Input.GetKey(KeyCode.LeftControl) &&
EClass.debug.godBuild;
28 public override BuildMenu.Mode buildMenuMode
38 public override int CostMoney
42 if (this.recipe ==
null || this.recipe.UseStock)
52 public override bool IsBuildMode
62 public override string idSound
72 public override bool AllowAutoClick
76 return this.recipe !=
null && !(this.recipe is
RecipeCard);
82 public override bool AllowMiddleClickFunc
92 public override int SelectorHeight
96 return this.bridgeHeight;
101 public override int TopHeight(
Point p)
103 return this.bridgeHeight + (this.recipe.tileType.AltitudeAsDir ? 0 : this.altitude);
107 public override HitResult HitResultOnDesignation(
Point p)
110 if (((detail !=
null) ? detail.designation :
null) is
TaskBuild)
112 return HitResult.Warning;
114 return HitResult.Invalid;
119 public override BaseTileSelector.HitType hitType
123 Recipe recipe = this.recipe;
128 return recipe.tileType.HitType;
134 public override BaseTileSelector.SelectType selectType
138 Recipe recipe = this.recipe;
143 return recipe.tileType.SelectType;
149 public override BaseTileSelector.BoxType boxType
153 Recipe recipe = this.recipe;
158 return recipe.GetBoxType();
164 public override int hitW
168 Recipe recipe = this.recipe;
179 public override int hitH
183 Recipe recipe = this.recipe;
195 if (!this.recipe.IsBlock)
197 return EClass.screen.guide.passGuideFloor;
199 return EClass.screen.guide.passGuideBlock;
203 public override bool ForcedInstaComplete(
TaskBuild t)
205 return this.recipe.tileType.CanInstaComplete;
209 public override void OnUpdateCursor()
211 base.SetCursorOnMap(CursorSystem.Build);
215 public override void OnActivate()
217 this.list = base.Designations.build;
222 public override void OnDeactivate()
224 base.Summary.SetRecipe(
null);
225 this.recipe = (this.mold.recipe =
null);
226 this.houseBoard =
null;
234 public override void OnCancel()
240 public void StartBuild(
Recipe r, Func<ButtonGrid> _button)
243 this.button = _button;
246 base.Activate(
true,
false);
248 base.CreateNewMold(
false);
249 this.bridgeHeight = -1;
251 base.Summary.SetRecipe(r);
252 EClass.ui.hud.hint.Refresh();
256 public override void OnCreateMold(
bool processing =
false)
258 this.mold.recipe = (processing ? this._recipe : this.recipe);
259 this.SetAltitude(this.altitude);
263 public override HitResult HitTest(
Point point,
Point start)
267 this.mold.bridgeHeight = (int)start.cell.bridgeHeight;
271 this.mold.bridgeHeight = (int)point.cell.bridgeHeight;
273 if (this.recipe ==
null)
275 return HitResult.Default;
277 if (this.IsRoofEditMode(
null))
279 return HitResult.Valid;
281 if (this.IsFillMode())
283 Cell cell = point.cell;
284 if (this.recipe.IsBridge)
286 if (cell._bridge != start.cell._bridge)
288 return HitResult.NoTarget;
290 return HitResult.Valid;
292 else if (this.recipe.IsFloor)
294 if (cell._floor != start.cell._floor)
296 return HitResult.NoTarget;
298 return HitResult.Valid;
300 else if (this.recipe.IsBlock)
302 if (cell._block != start.cell._block)
304 return HitResult.NoTarget;
306 return HitResult.Valid;
309 if (this.recipe.IsBridge &&
this.recipe.tileType.SelectType ==
BaseTileSelector.SelectType.Multiple && !point.Equals(start) && (
int)point.cell.height >
this.bridgeHeight +
this.altitude)
311 return HitResult.Invalid;
313 return base.HitTest(point, start);
319 this.bridgeHeight = -1;
322 this.bridgeHeight = (int)((
byte)((point.cell.bridgeHeight == 0) ? ((
int)point.cell.height + recipe.tileType.MinAltitude) : ((
int)point.cell.bridgeHeight)));
327 public unsafe
override void OnRenderTile(
Point point, HitResult result,
int dir)
329 if (this.recipe ==
null)
335 base.OnRenderTile(point, result, dir);
338 if (
EClass.screen.tileSelector.start ==
null)
340 this.FixBridge(point, this.recipe);
342 if (this.recipe.IsFloorOrBridge && !
this.recipe.IsBridge && point.cell.bridgeHeight != 0)
344 base.OnRenderTileFloor(point, result);
347 if (result != HitResult.Valid && result != HitResult.Warning)
349 base.OnRenderTile(point, result, dir);
352 if (this.bridgeHeight != -1)
354 Vector3 vector = *point.Position();
355 EClass.screen.guide.passGuideFloor.Add(vector.x, vector.y, vector.z - 0.01f, (
float)result, 0f);
357 int desiredDir = this.recipe.tileType.GetDesiredDir(point, this.recipe._dir);
358 if (desiredDir != -1)
360 dir = (this.recipe._dir = desiredDir);
362 bool main = !base.tileSelector.multisize || (base.tileSelector.firstInMulti && base.Summary.count == base.Summary.countValid);
363 this.recipe.OnRenderMarker(point,
false, result, main, dir, this.bridgeHeight + ((this.recipe.tileType.AltitudeAsDir && !
this.IsRoofEditMode(
null)) ? 0 :
this.altitude));
367 public override void OnBeforeProcessTiles()
369 this._recipe = this.recipe;
370 this._recipe._dir = this.recipe._dir;
371 this.mold.dir = this.recipe._dir;
372 base.OnBeforeProcessTiles();
376 public override void OnProcessTiles(
Point point,
int dir)
384 this.mold.dir = this.recipe._dir;
386 if (point.HasDesignation)
389 if (taskBuild !=
null && this.recipe.IsWallOrFence && taskBuild.recipe.IsWallOrFence && taskBuild.dir != dir)
391 dir = (this.mold.dir = 2);
396 detail.designation.Destroy();
399 this.mold.bridgeHeight = this.bridgeHeight;
400 this.SetAltitude(this.altitude);
401 base.OnProcessTiles(point, dir);
405 public override void OnFinishProcessTiles()
407 base.OnFinishProcessTiles();
409 if (this.recipe.UseStock)
411 Thing thing = this.recipe.ingredients[0].thing;
412 if (thing ==
null || thing.isDestroyed || thing.ExistsOnMap || thing.Num <= 0)
414 ActionMode.ignoreSound =
true;
417 buttonGrid.selected =
false;
418 buttonGrid.DoNormalTransition(
true);
421 BuildMenu.Instance.RefreshCategory(
EClass.player.pref.lastBuildCategory);
429 buttonGrid.SetRecipe();
431 if (this.recipe.IsBridge)
438 public override void RotateUnderMouse()
440 if (this.recipe !=
null && this.recipe.CanRotate)
443 this.recipe.Rotate();
450 public int MaxAltitude
454 if (!this.IsRoofEditMode(
null) || !(this.recipe.renderRow is
SourceBlock.
Row))
456 return this.recipe.MaxAltitude;
463 public override void InputWheel(
int wheel)
465 if (EInput.isAltDown || EInput.isCtrlDown)
469 if (this.recipe.MaxAltitude > 0)
471 this.ModAltitude(wheel);
472 EClass.screen.tileSelector.RefreshMouseInfo(
true);
475 base.InputWheel(wheel);
479 public void ModAltitude(
int a)
482 if (this.altitude < (this.recipe.IsBridge ? -10 : 0))
484 this.altitude = this.MaxAltitude;
486 if (this.altitude > this.MaxAltitude)
488 this.altitude = (this.recipe.IsBridge ? -10 : 0);
490 this.SetAltitude(this.altitude);
494 public void SetAltitude(
int a)
496 this.mold.altitude = a;
498 this.recipe.OnChangeAltitude(a);
499 if (this.recipe.tileType.AltitudeAsDir && !
this.IsRoofEditMode(
null))
501 this.mold.dir = (this.recipe._dir = this.altitude);
506 public int bridgeHeight;
518 public Func<ButtonGrid> button;