public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced) { Building_FermentingVat building_FermentingVat = t as Building_FermentingVat; WorkgiverFermentingVatProperties defProps = def.TryGetModExtension <WorkgiverFermentingVatProperties>(); if (defProps != null) { if (building_FermentingVat.def != defProps.outputThingDef) { return(false); } } return(building_FermentingVat != null && building_FermentingVat.Fermented && !t.IsBurning() && !t.IsForbidden(pawn) && pawn.CanReserveAndReach(t, PathEndMode.Touch, pawn.NormalMaxDanger(), 1)); }
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced) { if (!(t is Building_FermentingVat building_FermentingVat) || building_FermentingVat.Fermented || building_FermentingVat.SpaceLeftForInput <= 0) { return(false); } float temperature = building_FermentingVat.Position.GetTemperature(building_FermentingVat.Map); CompProperties_TemperatureRuinable compProperties = building_FermentingVat.def.GetCompProperties <CompProperties_TemperatureRuinable>(); if (temperature < compProperties.minSafeTemperature + 2f || temperature > compProperties.maxSafeTemperature - 2f) { Reset(); JobFailReason.Is(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 (FindInputThing(pawn, building_FermentingVat) == null) { Reset(); JobFailReason.Is(NoInputTrans); return(false); } WorkgiverFermentingVatProperties defProps = def.TryGetModExtension <WorkgiverFermentingVatProperties>(); if (defProps != null) { if (building_FermentingVat.def != defProps.inputThingDef) { return(false); } } return(!t.IsBurning()); }