public override void PostSpawnSetup() { fuelContainer = new ThingContainer(this, false); // internal temperature initialize internalTemp = parent.Position.GetTemperature(); // required comps initialize compFueled = parent.TryGetComp<CompFueled>(); compFlickable = parent.TryGetComp<CompFlickable>(); compHeatPusher = parent.TryGetComp<CompHeatPusher>(); heatPerSecond_fromXML = compHeatPusher.Props.heatPerSecond; compGlower = parent.TryGetComp<CompGlower>(); glowRadius_fromXML = compGlower.Props.glowRadius; // initialize glower and heater AdjustGlowerAndHeater(); // filters initialize filterFuelPossible.SetDisallowAll(); filterFuelPossible.allowedQualitiesConfigurable = false; filterFuelPossible.allowedHitPointsConfigurable = false; foreach (var thingDef in DefDatabase<ThingDef>.AllDefs.Where(def => !def.statBases.NullOrEmpty() && def.statBases.Exists(stat => stat.stat.defName == "MaxBurningTempCelsius" && stat.value > 0))) { filterFuelPossible.SetAllow(thingDef, true); } filterFuelCurrent.CopyAllowancesFrom(filterFuelPossible); }
public override void SpawnSetup(Map map, bool bla) { base.SpawnSetup(map, bla); heatPusherComp = GetComp <CompHeatPusher>(); flickableComp = GetComp <CompFlickable>(); glowerComp = GetComp <CompGlower>(); refuelableComp = GetComp <CompRefuelable>(); breakdownableComp = GetComp <CompBreakdownable>(); }
static void Turn(CompFlickable comp, bool value) { comp.wantSwitchOn = value; comp.SwitchIsOn = value; FlickUtility.UpdateFlickDesignation(comp.parent); Log.Message("v: " + value); }
public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish) { base.DeSpawn(mode); heatPusherComp = null; flickableComp = null; glowerComp = null; refuelableComp = null; breakdownableComp = null; }
// Token: 0x06000012 RID: 18 RVA: 0x00002CCC File Offset: 0x00001CCC public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); powerComp = GetComp <CompPowerTrader>(); powerComp.PowerOn = true; flickableComp = GetComp <CompFlickable>(); refuelableComp = GetComp <CompRefuelable>(); breakdownableComp = GetComp <CompBreakdownable>(); }
public override void Initialize(CompProperties props) { base.Initialize(props); powerTrader = parent.TryGetComp <CompPowerTrader>(); flickable = parent.TryGetComp <CompFlickable>(); prop = (Prop.VoidNetTowerProp)props; energyTransportPerSec = prop.energyTransportPerSec; transportToWorld = prop.transportToWorld; }
public override void SpawnSetup() { base.SpawnSetup(); UI_CHARGED = ContentFinder <Texture2D> .Get("Energy_Cell_Full", true); UI_DISCHARGED = ContentFinder <Texture2D> .Get("Energy_Cell_Empty", true); this.m_Power = base.GetComp <CompPowerTrader>(); this.m_Flick = base.GetComp <CompFlickable>(); }
/// <summary> /// This is called seperately when the Mod-Thread is done. /// It is needed to be seperately from SpawnSetup, so that the graphics can be found /// </summary> private void SpawnSetup_Part2() { this.powerComp = base.GetComp <CompPowerTrader_EmergencyPowerCore>(); this.refuelableComp = base.GetComp <CompRefuelable>(); this.breakdownableComp = base.GetComp <CompBreakdownable>(); this.flickableComp = base.GetComp <CompFlickable>(); if (!this.IsBrokenDown()) { this.powerComp.PowerOn = true; } }
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { var tc = t as ThingWithComps; if (t == null) { return(false); } var ventables = tc.AllComps.Where(x => x is IVentable); var thingComps = ventables as ThingComp[] ?? ventables.ToArray(); if (!thingComps.Any()) { return(false); } var toVent = ventables.FirstOrDefault(y => y is IVentable z && z.ShouldVentNow); if (toVent == null) { return(false); } if (!t.IsForbidden(pawn)) { LocalTargetInfo target = t; if (pawn.CanReserve(target, 1, -1, null, forced)) { if (t.Faction != pawn.Faction) { return(false); } ThingWithComps thingWithComps = t as ThingWithComps; if (thingWithComps != null) { CompFlickable comp = thingWithComps.GetComp <CompFlickable>(); if (comp != null && !comp.SwitchIsOn) { return(false); } } /* if (this.FindBestFuel(pawn, t) == null) * { * ThingFilter fuelFilter = t.TryGetComp<CompRefuelable>().Props.fuelFilter; * JobFailReason.Is("NoFuelToRefuel".Translate(new object[] * { * fuelFilter.Summary * })); * return false; * }*/ return(true); } } return(false); }
public static void Force(this CompFlickable flickable, bool mode) { if (mode != flickable.SwitchIsOn) { flickable.SwitchIsOn = mode; } if (flickable.WantsFlick()) { _flickable_wantSwitchOn_FI.SetValue(flickable, mode); } }
public override void ExposeData() { base.ExposeData(); if (Scribe.mode == LoadSaveMode.PostLoadInit) { if (this.flickableComp == null) { this.flickableComp = base.GetComp <CompFlickable>(); } } }
internal static void WantSwitchOn(this CompFlickable _this, bool newValue) { if (_wantSwitchOn == null) { _wantSwitchOn = typeof(CompFlickable).GetField("wantSwitchOn", BindingFlags.Instance | BindingFlags.NonPublic); if (_wantSwitchOn == null) { Log.ErrorOnce("Unable to reflect CompFlickable.wantSwitchOn!", 0x12348765); } } _wantSwitchOn.SetValue(_this, newValue); }
public static bool Prefix(CompFlickable __instance, bool ___switchOnInt, bool ___wantSwitchOn) { if (!(__instance is CompWindow compWindow)) { return(true); } if (Scribe.mode == LoadSaveMode.PostLoadInit) { compWindow.SetupState(); } return(false); }
public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); fuelComp = this.GetComp <CompRefuelable>(); powerComp = this.GetComp <CompPowerTrader>(); flickComp = this.GetComp <CompFlickable>(); LessonAutoActivator.TeachOpportunity(PMConceptDefOf.MergingPawns, OpportunityType.Important); LessonAutoActivator.TeachOpportunity(PMConceptDefOf.PM_PartPicker, OpportunityType.Important); LessonAutoActivator.TeachOpportunity(PMConceptDefOf.Tagging, OpportunityType.Important); }
public static void flickWaterCommandTex(CompFlickable __instance, ref Texture2D __result) { if (__instance?.parent?.GetComp <CompWater>() != null) { var Props = (CompProperties_Flickable)__instance.props; if (flickWaterTexture == null) { flickWaterTexture = TexButton.Estate_DesireWater; } __result = flickWaterTexture; } }
public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); this.powerTraderComp = this.GetComp <CompPowerTrader>(); this.flickableComp = this.GetComp <CompFlickable>(); this.InputConnectors = new List <IntVec3>(); this.OutputConnectors = new List <IntVec3>(); this.CreateConnectors(); this.WaterNetManager.AddThing(this); }
static void Switch(CompFlickable comp, bool value) { if (MP.IsInMultiplayer && !MP.IsHosting) { return; } Log.Message("wants " + value); LongEventHandler.ExecuteWhenFinished(delegate { Turn(comp, value); }); }
//On spawn, get the power and flickable comps, and destroy the possible building if it already exists public override void PostSpawnSetup(bool respawningAfterLoad) { base.PostSpawnSetup(respawningAfterLoad); this.compPower = this.parent.GetComp <CompPowerTrader>(); this.compFlickable = this.parent.GetComp <CompFlickable>(); if (newHologram != null && parent.Map != null) { if (!newHologram.Destroyed) { newHologram.Destroy(DestroyMode.Vanish); } } }
private void ConsumePowerIfNeeded() { CompPowerTrader compPower = parent.GetComp <CompPowerTrader>(); CompFlickable compFlickable = parent.GetComp <CompFlickable>(); if (compPower != null && compFlickable != null && compFlickable.SwitchIsOn && parent.Spawned) { if (mountedTo.needs.TryGetNeed(WTH_DefOf.WTH_Mechanoid_Power) is Need_Power powerNeed && !powerNeed.DirectlyPowered(mountedTo)) { powerNeed.CurLevel -= 0.35f + compPower.Props.basePowerConsumption * 0.0015f; } } }
private void SetPowerComp() { CompPowerTrader compPower = parent.GetComp <CompPowerTrader>(); if (compPower != null && parent.Spawned) { CompFlickable compFlickable = parent.GetComp <CompFlickable>(); if (compFlickable != null && compFlickable.SwitchIsOn) { compPower.PowerOn = true; } } }
public override void PostSpawnSetup(bool respawningAfterLoad) { base.PostSpawnSetup(respawningAfterLoad); flickComp = parent.GetComp <CompFlickable>(); if (inputSettings == null) { inputSettings = new StorageSettings(this); if (parent.def.building.defaultStorageSettings != null) { inputSettings.CopyFrom(parent.def.building.defaultStorageSettings); } } bioReactor = (Building_BioReactor)parent; }
public void CheckNeedsFlick() { if (master == null) { return; } CompFlickable masterflickable = master.TryGetComp <CompFlickable>(); CompFlickable flickable = this.TryGetComp <CompFlickable>(); if (masterflickable.SwitchIsOn != flickable.SwitchIsOn) { flickable.DoFlick(); } }
public override void PostSpawnSetup(bool respawningAfterLoad) { compFlickable = parent.GetComp <CompFlickable>(); compPowerTrader = parent.GetComp <CompPowerTrader>(); GasManager = parent.Map.GetComponent <GasManager>(); GasManager.RegisterPipe(this, respawningAfterLoad); pipeTypeInt = (int)PipeType; base.PostSpawnSetup(respawningAfterLoad); }
public override void PostSpawnSetup() { base.PostSpawnSetup(); IncidentDef incidentDef = DefDatabase <IncidentDef> .GetNamed("ShortCircuit"); if (incidentDef.workerClass != typeof(IncidentWorker_RTShortCircuit)) { incidentDef.workerClass = typeof(IncidentWorker_RTShortCircuit); DefDatabase <IncidentDef> .ResolveAllReferences(); Log.Message("RT_Fuse: replaced IncidentWorker for ShortCircuit."); } compBreakdownable = parent.TryGetComp <CompBreakdownable>(); compFlickable = parent.TryGetComp <CompFlickable>(); }
public override void PostSpawnSetup(bool respawningAfterLoad) { base.PostSpawnSetup(respawningAfterLoad); lastTickStagger++; tickStagger = lastTickStagger; compFlickable = parent.TryGetComp <CompFlickable>(); if (compFlickable == null) { Log.Error("CompRTPowerSwitch could not get parent's CompFlickable!"); } emergencyPowerResearchCompleted_dirty = true; }
/// <summary> /// This is called seperately when the Mod-Thread is done. /// It is needed to be seperately from SpawnSetup, so that the graphics can be found /// </summary> private void SpawnSetup_Part2() { GetTextures(); DestroyOtherPowerTransmitter(); //// Wall: can't have this deactive! //if (isWall) // pawnSearchModeDistanceActive = true; this.flickableComp = base.GetComp <CompFlickable>(); // Initialized init = true; }
public override void PostSpawnSetup(bool respawningAfterLoad) { base.PostSpawnSetup(respawningAfterLoad); flickable = parent.GetComp <CompFlickable>(); breakdownable = parent.GetComp <CompBreakdownable>(); schedule = parent.GetComp <CompSchedule>(); // set flickable to false, to avoid immediately flooding the area with // deadly toxins. if (!respawningAfterLoad && flickable != null) { flickable.SwitchIsOn = false; } // get ventPos ventPos = GenGas.VentingPosition(parent); }
public override void PostSpawnSetup() { base.PostSpawnSetup(); lastTickStagger++; tickStagger = lastTickStagger; compFlickable = parent.TryGetComp <CompFlickable>(); if (compFlickable == null) { Log.Error("CompRTPowerSwitch could not get parent's CompFlickable!"); } cellIndex = tickStagger; cells = GenAdj.CellsAdjacentCardinal(parent).ToList(); while (cellIndex > cells.Count) { cellIndex -= cells.Count; } }
/// <summary> /// This is called seperately when the Mod-Thread is done. /// It is needed to be seperately from SpawnSetup, so that the graphics can be found /// </summary> private void SpawnSetup_Part2() { GetTextures(); DestroyOtherPowerTransmitter(); // Wall: can't have this deactive! bool isWall = RegionAndRoomQuery.RoomAt(this.Position, this.Map) == null; if (isWall) { pawnSearchModeDistanceActive = true; } this.flickableComp = base.GetComp <CompFlickable>(); // Initialized init = true; }
public static Building_BaseMechanoidPlatform GetAvailableMechanoidPlatform(Pawn pawn, Pawn targetPawn) { return((Building_BaseMechanoidPlatform)GenClosest.ClosestThingReachable(targetPawn.Position, targetPawn.Map, ThingRequest.ForGroup(ThingRequestGroup.BuildingArtificial), PathEndMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, delegate(Thing b) { if (b is Building_BaseMechanoidPlatform platform && !b.IsBurning() && !b.IsForbidden(targetPawn) && targetPawn.CanReserve(b) && (targetPawn.ownership.OwnedBed == null && !platform.CompAssignableToPawn.AssignedPawns.Any() || platform.CompAssignableToPawn.AssignedPawns.Contains(targetPawn))) { CompFlickable flickable = platform.TryGetComp <CompFlickable>(); if (flickable != null && !flickable.SwitchIsOn) { return false; } return true; } return false; })); }
public override IEnumerable <Command> CompGetGizmosExtra() { if (canSwitchModes) { Command_Action commandModeSwitch = new Command_Action(); commandModeSwitch.groupKey = 676192; if (switchedToChunkSilo) { commandModeSwitch.defaultLabel = "CompRTDeviceModeSwitcher_StockpileModeLabel".Translate(); commandModeSwitch.defaultDesc = "CompRTDeviceModeSwitcher_StockpileModeDesc".Translate(); commandModeSwitch.icon = Resources.stockpileTexture; } else { commandModeSwitch.defaultLabel = "CompRTDeviceModeSwitcher_ChunkSiloModeLabel".Translate(); commandModeSwitch.defaultDesc = "CompRTDeviceModeSwitcher_ChunkSiloModeDesc".Translate(); commandModeSwitch.icon = Resources.chunkSiloTexture; } commandModeSwitch.action = () => { CompFlickable compFlickable = parent.TryGetComp <CompFlickable>(); if (compFlickable != null) { compFlickable.ResetToOn(); compFlickable.DoFlick(); FlickUtility.UpdateFlickDesignation(parent); } if (switchedToChunkSilo) { CompRTQuantumChunkSilo compChunkSilo = parent.TryGetComp <CompRTQuantumChunkSilo>(); if (compChunkSilo != null) { compChunkSilo.EmptyOut(); } } switchedToChunkSilo = !switchedToChunkSilo; SortOutComps(); }; yield return(commandModeSwitch); } }
public override void PostSpawnSetup() { base.PostSpawnSetup(); IncidentDef incidentDef = DefDatabase<IncidentDef>.GetNamed("ShortCircuit"); if (incidentDef.workerClass != typeof(IncidentWorker_RTShortCircuit)) { incidentDef.workerClass = typeof(IncidentWorker_RTShortCircuit); DefDatabase<IncidentDef>.ResolveAllReferences(); Log.Message("RT_Fuse: replaced IncidentWorker for ShortCircuit."); } compBreakdownable = parent.TryGetComp<CompBreakdownable>(); compFlickable = parent.TryGetComp<CompFlickable>(); }