private Thing GetBestSeedThingForSowing( Pawn pawn, IntVec3 cell, ThingDef_PlantWithSeeds customPlantDef )
        {
            Thing seedThing = null;

            Predicate<Thing> predicate = (Thing tempThing ) => !tempThing.IsForbidden( pawn.Faction ) && pawn.AwareOf( tempThing ) && pawn.CanReserve( tempThing);

            if ( customPlantDef.SeedDef != null )
            {
                seedThing = GenClosest.ClosestThingReachable(cell, ThingRequest.ForDef(customPlantDef.SeedDef), PathEndMode.ClosestTouch,
                    TraverseParms.For( pawn ), 9999f,  predicate );
            }

            return seedThing;
        }
Пример #2
0
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            m_CustomPlantDef = def as ThingDef_PlantWithSeeds;
        }