예제 #1
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Building_FermentingVat building_FermentingVat = (Building_FermentingVat)t;
            Thing t2 = this.FindInputThing(pawn, building_FermentingVat);

            return(JobMaker.MakeJob(JobDefToUse, t, t2));
        }
예제 #2
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced)
        {
            Building_FermentingVat building_FermentingVat = (Building_FermentingVat)t;
            Thing t2 = this.FindInputThing(pawn, building_FermentingVat);

            return(new Job(JobDefToUse, t, t2)
            {
                count = building_FermentingVat.SpaceLeftForInput
            });
        }
예제 #3
0
        private Thing FindInputThing(Pawn pawn, Building_FermentingVat barrel)
        {
            Predicate <Thing> validator = (Thing x) => !x.IsForbidden(pawn) && pawn.CanReserve(x, 1, -1, null, false);
            ThingDef          input_def = null;
            VatProperties     vatProps  = barrel.def.TryGetModExtension <VatProperties>();

            if (vatProps != null)
            {
                input_def = vatProps.inputThingDef;
            }
            //Log.Message("input_def: " + input_def);
            return(GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForDef(input_def), PathEndMode.ClosestTouch, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, validator, null, 0, -1, false, RegionType.Set_Passable, false));
        }
        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));
        }