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 DeSpawn(DestroyMode mode = DestroyMode.Vanish) { base.DeSpawn(mode); heatPusherComp = null; flickableComp = null; glowerComp = null; refuelableComp = null; breakdownableComp = null; }
public override void SpawnSetup(Map map, bool bla) { base.SpawnSetup(map, bla); heatPusherComp = base.GetComp <CompHeatPusher>(); flickableComp = base.GetComp <CompFlickable>(); glowerComp = base.GetComp <CompGlower>(); refuelableComp = base.GetComp <CompRefuelable>(); breakdownableComp = base.GetComp <CompBreakdownable>(); }
public static float GetHeatPushedPerSecond(StatRequest req, bool applyPostProcess = true) { CompHeatPusher comp = req.Thing.TryGetComp <CompHeatPusher>(); float heatPerSecond = comp.Props.heatPerSecond; float surface = comp.parent.PositionHeld.GetRoomGroup(comp.parent.Map).CellCount; float heatPushedPerSecond = heatPerSecond / surface; return(heatPushedPerSecond); }
public override void SpawnSetup() { base.SpawnSetup(); power = GetComp <CompPowerTrader>(); heater = GetComp <CompHeatPusher>(); nextTemperatureCheck = -(thingIDNumber % 20); compDef = def as PalComponentDef; drawMatrix.SetTRS(DrawPos + Altitudes.AltIncVect /**(1+thingIDNumber*0.0001f)*/, Gen.ToQuat(90), Vector3.one); animationFrames = LoadAnimation(); nullGraphic = GraphicDatabase.Get <Graphic_Single>(def.graphicData.texPath, def.graphic.Shader, def.graphicData.drawSize, Color.clear); drawPosHeatPie = DrawPos + Altitudes.AltIncVect * (1 + thingIDNumber * 0.0001f); heatPieMat = MaterialPool.MatFrom("UI/HeatPieRed", ShaderDatabase.ShaderFromType(ShaderType.MetaOverlay)); }
public static void UnsetCompHeatPusher(Thing t, Map map) { CompHeatPusher comp = t.TryGetComp <CompHeatPusher>(); if (comp is CompHeatPusher) { comp.PostDestroy(DestroyMode.Vanish, map); } //comp.PostDeSpawn(map); else { Tools.Warn("should have found a CompHeatPusher but no CompHeatPusher found", true); } }
public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense) { CompHeatPusher comp = req.Thing.TryGetComp <CompHeatPusher>(); float heatPerSecond = comp.Props.heatPerSecond; float surface = comp.parent.PositionHeld.GetRoomGroup(comp.parent.Map).CellCount; float heatPushedPerSecond = heatPerSecond / surface; SEB seb = new SEB("StatsReport_RWHS"); seb.Simple("HeatPushedPerSecond", heatPerSecond); seb.Simple("RoomSurface", surface); seb.Full("HeatOutputPerSecond", heatPushedPerSecond, heatPerSecond, surface); return(seb.ToString()); }
public float wetnessRate() { float rate = 0f; //check if the pawn is in water TerrainDef terrain = this.pawn.Position.GetTerrain(this.pawn.MapHeld); if (terrain != null && terrain.HasTag("TKKN_Wet")) { //deep water gets them soaked. if (terrain.HasTag("TKKN_Swim")) { if (this.Severity < .65f) { this.Severity = .65f; } rate = .3f; return(rate); } else { rate = .05f; } } //check if the pawn is wet from the weather bool roofed = this.pawn.MapHeld.roofGrid.Roofed(this.pawn.Position); if (!roofed && this.pawn.MapHeld.weatherManager.curWeather.rainRate > .001f) { rate = this.pawn.MapHeld.weatherManager.curWeather.rainRate / 10; } if (!roofed && this.pawn.MapHeld.weatherManager.curWeather.snowRate > .001f) { rate = this.pawn.MapHeld.weatherManager.curWeather.snowRate / 100; } if (rate == 0f) { timeDrying++; } else { timeDrying = 0; return(rate); } //dry the pawn. if (pawn.AmbientTemperature > 0) { rate -= pawn.AmbientTemperature / 200; } //check if the pawn is near a heat source foreach (IntVec3 c in GenAdj.CellsAdjacentCardinal(pawn)) { if (!c.InBounds(pawn.MapHeld) || !c.IsValid) { continue; } List <Thing> things = c.GetThingList(pawn.MapHeld); for (int i = 0; i < things.Count; i++) { Thing thing = things[i]; CompHeatPusher heater = thing.TryGetComp <CompHeatPusher>(); if (heater != null) { rate -= heater.Props.heatPerSecond / 5000; } } } rate -= timeDrying / 250; // Log.Warning(rate.ToString()); return(rate); }