public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { Building_AC_CompostBin CompostBin = t as Building_AC_CompostBin; if (CompostBin == null || CompostBin.Fermented || CompostBin.SpaceLeftForCompost <= 0) { return(false); } float temperature = CompostBin.Position.GetTemperature(CompostBin.Map); CompProperties_AC_Fermenter compProperties = CompostBin.def.GetCompProperties <CompProperties_AC_Fermenter>(); if (temperature < compProperties.minSafeTemp || temperature > compProperties.maxSafeTemp) { JobFailReason.Is(WorkGiver_FillCompostBin.TemperatureTrans); return(false); } if (t.IsForbidden(pawn) || !pawn.CanReserveAndReach(t, PathEndMode.Touch, pawn.NormalMaxDanger(), 1)) { return(false); } if (pawn.Map.designationManager.DesignationOn(t, DesignationDefOf.Deconstruct) != null) { return(false); } if (this.FindCompost(pawn, CompostBin) == null) { JobFailReason.Is(WorkGiver_FillCompostBin.NoCompostTrans); return(false); } return(!t.IsBurning()); }
public override string GetInspectString() { CompProperties_AC_Fermenter compProperties = this.def.GetCompProperties <CompProperties_AC_Fermenter>(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(base.GetInspectString()); if (stringBuilder.Length != 0) { stringBuilder.AppendLine(); } AC_CompFermenter comp = base.GetComp <AC_CompFermenter>(); if (!this.Empty && !comp.Ruined) { if (this.Fermented) { stringBuilder.AppendLine(string.Concat(new string[] { "AC.ContainsFermentedCompost".Translate(), ": ", this.compostCount.ToString(), " / ", this.Capacity.ToString() })); } else { stringBuilder.AppendLine(string.Concat(new string[] { "AC.ContainsRawCompost".Translate(), ": ", this.compostCount.ToString(), " / ", this.Capacity.ToString() })); } } stringBuilder.AppendLine("AC.Temp".Translate() + ": " + base.AmbientTemperature.ToStringTemperature("F0")); stringBuilder.AppendLine(string.Concat(new string[] { "AC.IdealTemp".Translate(), ": ", compProperties.minFermentTemp.ToStringTemperature("F0"), "-", compProperties.maxFermentTemp.ToStringTemperature("F0") })); return(stringBuilder.ToString().TrimEndNewlines()); }
private void DoTicks(int ticks) { if (this.parent.IsHashIntervalTick(60) && this.ShouldPushHeatNow) { CompProperties_AC_Fermenter props = this.Props; float ambientTemperature = this.parent.AmbientTemperature; if (ambientTemperature < props.heatPushMaxTemperature && ambientTemperature > props.heatPushMinTemperature) { GenTemperature.PushHeat(this.parent.Position, this.parent.Map, props.heatPerSecondPerFermenter * this.FermenterCount); } } if (!this.Ruined) { if (this.FermenterCount > 0) { if (this.fermentProgress < 1f) { float fermentPerTick = this.FermentProgressPerTickAtCurrentTemp; this.fermentProgress += fermentPerTick * ticks; } } if (this.fermentProgress >= 1f) { if (this.parent.GetType() != typeof(Building_AC_CompostBin)) { Thing thing = ThingMaker.MakeThing(this.Props.fermentedThing, null); thing.stackCount = this.parent.stackCount; GenSpawn.Spawn(thing, this.parent.Position, this.parent.Map); this.parent.Destroy(DestroyMode.Vanish); } } } else { if (this.parent.IsInAnyStorage() && this.parent.SpawnedOrAnyParentSpawned) { Messages.Message(TranslatorFormattedStringExtensions.Translate("AC.CompostRuined", parent.Label) .CapitalizeFirst(), new TargetInfo(this.parent.PositionHeld, this.parent.MapHeld, false), MessageTypeDefOf.NegativeEvent, true); } if (this.parent.GetType() != typeof(Building_AC_CompostBin)) { this.parent.Destroy(DestroyMode.Vanish); } } this.UpdateRuinedPercent(ticks); }