コード例 #1
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Building_FermentingOniWineBarrel building_FermentingOniWineBarrel = t as Building_FermentingOniWineBarrel;

            if (building_FermentingOniWineBarrel == null || building_FermentingOniWineBarrel.Fermented || building_FermentingOniWineBarrel.SpaceLeftForDemonBreathWort <= 0)
            {
                return(false);
            }
            float ambientTemperature = building_FermentingOniWineBarrel.AmbientTemperature;
            CompProperties_TemperatureRuinable compProperties = building_FermentingOniWineBarrel.def.GetCompProperties <CompProperties_TemperatureRuinable>();

            if (ambientTemperature < compProperties.minSafeTemperature + 2f || ambientTemperature > compProperties.maxSafeTemperature - 2f)
            {
                JobFailReason.Is(WorkGiver_FillFermentingOniWineBarrel.TemperatureTrans, null);
                return(false);
            }
            if (t.IsForbidden(pawn) || !pawn.CanReserve(t, 1, -1, null, forced))
            {
                return(false);
            }
            if (pawn.Map.designationManager.DesignationOn(t, DesignationDefOf.Deconstruct) != null)
            {
                return(false);
            }
            if (this.FindDemonBreathWort(pawn, building_FermentingOniWineBarrel) == null)
            {
                JobFailReason.Is(WorkGiver_FillFermentingOniWineBarrel.NoDemonBreathWortTrans, null);
                return(false);
            }
            return(!t.IsBurning());
        }
コード例 #2
0
        public override bool HasJobOnThing(Pawn pawn, Thing thing, bool forced = false)
        {
            Building_Processing building = thing as Building_Processing;

            if (building == null || building.Completed || building.SpaceLeft <= 0)
            {
                return(false);
            }
            float ambientTemperature = building.AmbientTemperature;
            CompProperties_TemperatureRuinable compProperties = building.def.GetCompProperties <CompProperties_TemperatureRuinable>();

            if (compProperties != null && (ambientTemperature < compProperties.minSafeTemperature + 2f || ambientTemperature > compProperties.maxSafeTemperature - 2f))
            {
                JobFailReason.Is(TemperatureTrans);
                return(false);
            }
            if (thing.IsForbidden(pawn) || !pawn.CanReserve(thing, 1, -1, null, forced))
            {
                return(false);
            }
            if (pawn.Map.designationManager.DesignationOn(thing, DesignationDefOf.Deconstruct) != null)
            {
                return(false);
            }
            if (FindIngredient(pawn, building) == null)
            {
                JobFailReason.Is(NoIngredientTrans);
                return(false);
            }
            return(!thing.IsBurning());
        }
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            var wineFermenter = t.TryGetComp <CompWineFermenter>();

            if (wineFermenter == null || wineFermenter.Fermented || wineFermenter.SpaceLeftForMust <= 0)
            {
                return(false);
            }
            float ambientTemperature = wineFermenter.parent.AmbientTemperature;
            CompProperties_TemperatureRuinable compProperties = wineFermenter.TemperatureRuinableComp.Props;

            if (ambientTemperature < compProperties.minSafeTemperature + 2f || ambientTemperature > compProperties.maxSafeTemperature - 2f)
            {
                JobFailReason.Is("BadTemperature".Translate().ToLower(), null);
                return(false);
            }
            if (!t.IsForbidden(pawn))
            {
                LocalTargetInfo target = t;
                if (pawn.CanReserve(target, 1, -1, null, forced))
                {
                    if (pawn.Map.designationManager.DesignationOn(t, DesignationDefOf.Deconstruct) != null)
                    {
                        return(false);
                    }
                    if (this.FindMust(pawn, wineFermenter) == null)
                    {
                        JobFailReason.Is("VanillaFactionsExpanded.NoMust".Translate(), null);
                        return(false);
                    }
                    return(!t.IsBurning());
                }
            }
            return(false);
        }
コード例 #4
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced)
        {
            Building_FermentingVat building_FermentingVat = t as Building_FermentingVat;

            if (building_FermentingVat == null || 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 (this.FindInputThing(pawn, building_FermentingVat) == null)
            {
                Reset();
                JobFailReason.Is(NoInputTrans);
                return(false);
            }
            WorkGiverDynamicDef dyn_def = def as WorkGiverDynamicDef;

            if (dyn_def != null && dyn_def.inputThingDef != null)
            {
                if (building_FermentingVat.def != dyn_def.inputThingDef)
                {
                    return(false);
                }
            }

            return(!t.IsBurning());
        }
コード例 #5
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Building_GrapheneVat building_GrapheneVat = t as Building_GrapheneVat;

            if (building_GrapheneVat == null || building_GrapheneVat.Reacted || building_GrapheneVat.SpaceLeftForGrapheneCartridge <= 0)
            {
                return(false);
            }
            float ambientTemperature = building_GrapheneVat.AmbientTemperature;
            CompProperties_TemperatureRuinable compProperties = building_GrapheneVat.def.GetCompProperties <CompProperties_TemperatureRuinable>();

            if (ambientTemperature < compProperties.minSafeTemperature + 2f || ambientTemperature > compProperties.maxSafeTemperature - 2f)
            {
                JobFailReason.Is(TemperatureTrans);
                return(false);
            }
            if (!t.IsForbidden(pawn))
            {
                LocalTargetInfo target = t;
                bool            ignoreOtherReservations = forced;
                if (pawn.CanReserve(target, 1, -1, null, ignoreOtherReservations))
                {
                    if (pawn.Map.designationManager.DesignationOn(t, DesignationDefOf.Deconstruct) != null)
                    {
                        return(false);
                    }
                    Thing thing = FindGrapheneCartridge(pawn, building_GrapheneVat);
                    if (thing == null)
                    {
                        JobFailReason.Is(NoGrapheneCartridgeTrans);
                        return(false);
                    }
                    if (t.IsBurning())
                    {
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
コード例 #6
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            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.ClosestTouch, 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());
        }
        // Token: 0x0600001C RID: 28 RVA: 0x00002A84 File Offset: 0x00001A84
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Building_sd_luciprod_distillery building_sd_luciprod_distillery = t as Building_sd_luciprod_distillery;
            bool result;

            if (building_sd_luciprod_distillery == null || building_sd_luciprod_distillery.Distilled || building_sd_luciprod_distillery.sd_luciprod_SpaceLeftFor_oil <= 0)
            {
                result = false;
            }
            else
            {
                float temperature = building_sd_luciprod_distillery.Position.GetTemperature(building_sd_luciprod_distillery.Map);
                CompProperties_TemperatureRuinable compProperties = building_sd_luciprod_distillery.def.GetCompProperties <CompProperties_TemperatureRuinable>();
                if (temperature < compProperties.minSafeTemperature + 2f || temperature > compProperties.maxSafeTemperature - 2f)
                {
                    JobFailReason.Is(WorkGiver_sd_luciprod_FillDistillery.TemperatureTrans, null);
                    result = false;
                }
                else if (t.IsForbidden(pawn) || !pawn.CanReserveAndReach(t, PathEndMode.Touch, pawn.NormalMaxDanger(), 1, -1, null, false))
                {
                    result = false;
                }
                else if (pawn.Map.designationManager.DesignationOn(t, DesignationDefOf.Deconstruct) != null)
                {
                    result = false;
                }
                else if (this.Findmech_oil(pawn, building_sd_luciprod_distillery) == null)
                {
                    JobFailReason.Is(WorkGiver_sd_luciprod_FillDistillery.sd_luciprod_mechanite_No_oil_Trans, null);
                    result = false;
                }
                else
                {
                    result = !t.IsBurning();
                }
            }
            return(result);
        }