public void DeRegisterWindow(Building_Window window) { if (cachedWindows.Contains(window)) { cachedWindows.Remove(window); } }
public override IEnumerable <Gizmo> CompGetGizmosExtra() { if (parent.Faction == Faction.OfPlayer) { Building_Window window = parent as Building_Window; yield return(new Command_Toggle() { hotKey = KeyBindingDefOf.Command_TogglePower, icon = (Texture2D)AccessTools.Property(typeof(CompFlickable), "CommandTex").GetValue(this), defaultLabel = Props.commandLabelKey.Translate(), defaultDesc = Props.commandDescKey.Translate() + ManualNote, isActive = () => WantSwitchOn, disabled = GizmoDisable, disabledReason = window.alarmReact ? "DisabledByEmergency".Translate() : "DisabledForAutoVentilation".Translate(), toggleAction = delegate() { AutoFlickRequest(); } }); //foreach (Gizmo gizmo in base.CompGetGizmosExtra()) //{ // if (gizmo is Command_Toggle toggle) // { // toggle.isActive = () => wantSwitchOn; // toggle.toggleAction = delegate () // { // wantSwitchOn = !wantSwitchOn; // FlickUtility.UpdateFlickDesignation(parent); // }; // } //} } yield break; }
public void RegisterWindow(Building_Window window) { if (!cachedWindows.Contains(window)) { cachedWindows.Add(window); } }
public static int Postfix(int result, Building b, TraverseParms traverseParms, Pawn pawn) { Building_Window window = b as Building_Window; if (window == null) { return(result); } switch (traverseParms.mode) { case TraverseMode.ByPawn: case TraverseMode.PassDoors: if (traverseParms.canBash) { return(300); } if (pawn.CurJob?.attackDoorIfTargetLost == true || pawn.MentalState is MentalState_Manhunter) { return(100 + (int)(window.HitPoints * 0.2f)); } return(int.MaxValue); case TraverseMode.NoPassClosedDoors: case TraverseMode.NoPassClosedDoorsOrWater: return(int.MaxValue); case TraverseMode.PassAllDestroyableThings: case TraverseMode.PassAllDestroyableThingsNotWater: return(50 + (int)(window.HitPoints * 0.2f)); default: return(result); } }
public override void TransformValue(StatRequest req, ref float value) { Building_Window window = req.Thing as Building_Window; if (req.HasThing && window != null) { value += WindowViewBeauty(window); } return; }
public ScanLine(Building_Window window, IntVec3 pos) { position = pos; parent = window; map = parent.Map; maxreach = parent.reach + WindowUtility.deep; horizontal = window.Rotation.IsHorizontal; bleeds = ShouldBleed(); SetScanLine(); FindObstruction(IntVec3.Zero); }
public static float WindowBaseBlockChance(Building_Window window, float result) { if (FlickUtility.WantsToBeOn(window)) { return(WindowBaseFillPercent); } else { return(result); } }
public override string ExplanationPart(StatRequest req) { Building_Window window = req.Thing as Building_Window; if (req.HasThing && window != null) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("LandscapeToThe".Translate(window.FacingCardinal().ToString().Translate().ToLower()) + ": " + WindowViewBeauty(window)); return(stringBuilder.ToString().TrimEndNewlines()); } return(null); }
public void SetupState() { Building_Window window = parent as Building_Window; bool state = false; if (Props.signal == "light" || Props.signal == "both") { state = window.open; } else if (Props.signal == "air") { state = window.venting; } WantSwitchOn = state; SwitchOnInt = state; SwitchIsOn = state; }
public void SetupState() { Building_Window window = parent as Building_Window; bool state = false; if (Props.signal == "light" || Props.signal == "both") { state = window.open; } else if (Props.signal == "air") { state = window.venting; } baseWantSwitchInfo.SetValue(this, state); baseSwitchOnIntInfo.SetValue(this, state); SwitchIsOn = state; }
public float WindowViewBeauty(Building_Window window) { if (window != null && window.open && window.isFacingSet && window.view.Count > 0) { IEnumerable <IntVec3> view = window.view; float result = 0; List <Thing> counted = new List <Thing>(); foreach (IntVec3 c in view) { var things = window.Map.thingGrid.ThingsListAt(c).Except(counted); var skipped = things.Where(FilterOut); result += BeautyUtility.CellBeauty(c, window.Map, skipped.Union(counted).ToList()); counted.AddRange(things); } return(result); } return(0f); }
public static void Postfix(PathGrid __instance, IntVec3 c, bool perceivedStatic, IntVec3 prevCell, Map ___map, ref int __result) { if (__result == 10000) { Building_Window window = c.GetEdifice(___map) as Building_Window; if (window != null) { int cost = 10; if (perceivedStatic) { for (int j = 0; j < 9; j++) { IntVec3 intVec = GenAdj.AdjacentCellsAndInside[j]; IntVec3 c2 = c + intVec; if (c2.InBounds(___map)) { Fire fire = null; List <Thing> list = ___map.thingGrid.ThingsListAtFast(c2); for (int k = 0; k < list.Count; k++) { fire = (list[k] as Fire); if (fire != null) { break; } } if (fire != null && fire.parent == null) { if (intVec.x == 0 && intVec.z == 0) { cost += 1000; } else { cost += 150; } } } } } __result = cost; } } }
public override IEnumerable <Gizmo> CompGetGizmosExtra() { if (parent.Faction == Faction.OfPlayer) { Building_Window window = parent as Building_Window; yield return(new Command_Toggle() { hotKey = KeyBindingDefOf.Command_TogglePower, icon = (Texture2D)AccessTools.Property(typeof(CompFlickable), "CommandTex").GetValue(this), defaultLabel = Props.commandLabelKey.Translate(), defaultDesc = Props.commandDescKey.Translate() + ManualNote, isActive = () => WantSwitchOn, disabled = GizmoDisable, disabledReason = window.alarmReact ? "DisabledByEmergency".Translate() : "DisabledForAutoVentilation".Translate(), toggleAction = delegate() { FlickFor(!WantSwitchOn); } }); } yield break; }
public static void Postfix(Building b, TraverseParms traverseParms, Pawn pawn, ref int __result) { Building_Window window = b as Building_Window; if (window != null) { switch (traverseParms.mode) { case TraverseMode.ByPawn: case TraverseMode.PassDoors: if (traverseParms.canBash) { __result = 300; } else if (pawn.CurJob.attackDoorIfTargetLost) { __result = 100 + (int)(window.HitPoints * 0.2f); } else { __result = int.MaxValue; } break; case TraverseMode.NoPassClosedDoors: case TraverseMode.NoPassClosedDoorsOrWater: __result = int.MaxValue; break; case TraverseMode.PassAllDestroyableThings: case TraverseMode.PassAllDestroyableThingsNotWater: __result = 50 + (int)(window.HitPoints * 0.2f); break; } } }
public static bool IsInterior(this IntVec3 cell, Building_Window window) { return(cell.IsInterior(window.Position, window.Facing)); }
public static void FindEnds(Building_Window window) { window.start = FindEnd(window.Position, window.Rotation, window.def.size, false); window.end = FindEnd(window.Position, window.Rotation, window.def.size, true); }