Пример #1
0
        // Token: 0x06000956 RID: 2390 RVA: 0x0004D678 File Offset: 0x0004BA78
        protected override bool Satisfied(Pawn pawn)
        {
            LifeStageDef stage = pawn.ageTracker.CurLifeStage;

#if DEBUG
            bool selected = Find.Selector.SingleSelectedThing == pawn;
            //   if (selected&&stage != pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def) Log.Message(string.Format("ThinkNode_ConditionalNotGrown {0} \nCurLifeStage:{1} FinalLifeStage:{2}", pawn.Label, stage, pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def));
#endif
            return(stage != pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def);
        }
        // Token: 0x06000956 RID: 2390 RVA: 0x0004D678 File Offset: 0x0004BA78
        protected override bool Satisfied(Pawn pawn)
        {
            LifeStageDef stage = pawn.ageTracker.CurLifeStage;

#if DEBUG
            bool selected = Find.Selector.SingleSelectedThing == pawn;
            if (selected && pawn.kindDef != XenomorphDefOf.RRY_Xenomorph_FaceHugger && stage == pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def)
            {
                Log.Message(string.Format("ThinkNode_ConditionalFullyGrown {0} \nCurLifeStage:{1} FinalLifeStage:{2}", pawn.Label, stage, pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def));
            }
#endif
            return(stage == pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def);
        }
        // Token: 0x060004FD RID: 1277 RVA: 0x000321F8 File Offset: 0x000305F8
        protected override Job TryGiveJob(Pawn pawn)
        {
            bool         selected           = Find.Selector.SelectedObjects.Contains(pawn) && Prefs.DevMode;
            Need_Food    food               = pawn.needs.food;
            LifeStageDef stage              = pawn.ageTracker.CurLifeStage;
            bool         desperate          = food.CurCategory >= HungerCategory.Starving;
            bool         canRefillDispenser = false;
            bool         canUseInventory    = false;
            bool         allowCorpse        = true;
            bool         flag3              = this.forceScanWholeMap;

            if (stage == pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def)
            {
                if (selected)
                {
                    Log.Message(string.Format("adult {0} @ {1}", pawn, pawn.Position));
                }
                if (food.CurCategory == HungerCategory.Fed)
                {
                    return(null);
                }
            }
            else
            {
                if (selected)
                {
                    Log.Message(string.Format("young {0} @ {1}", pawn, pawn.Position));
                }

                /*
                 * if (food.CurCategory == HungerCategory.Fed)
                 * {
                 *  return null;
                 * }
                 */
            }

            float nutrition;

            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate, out Thing thing, out ThingDef thingDef, canRefillDispenser, canUseInventory, true, allowCorpse, true, pawn.IsWildMan(), flag3))
            {
                return(null);
            }
            if (thing is Corpse corpse)
            {
                if (selected)
                {
                    Log.Message(string.Format("{0} is corpse @ {1}", thing, thing.Position));
                }
                nutrition = FoodUtility.GetNutrition(thing, thingDef);
                return(new Job(XenomorphDefOf.RRY_Neomorph_Ingest, thing)
                {
                    count = FoodUtility.WillIngestStackCountOf(pawn, thingDef, nutrition)
                });
            }
            if (thing is Pawn pawn2)
            {
                if (selected)
                {
                    Log.Message(string.Format("{0} is pawn @ {1}", thing, thing.Position));
                }
                if (pawn2 != null)
                {
                    return(new Job(JobDefOf.PredatorHunt, pawn2)
                    {
                        killIncappedTarget = true
                    });
                }
            }
            nutrition = FoodUtility.GetNutrition(thing, thingDef);
            if (selected)
            {
                Log.Message(string.Format("{0} is thing @ {1}", thing, thing.Position));
            }
            return(new Job(XenomorphDefOf.RRY_Neomorph_Ingest, thing)
            {
                count = FoodUtility.WillIngestStackCountOf(pawn, thingDef, nutrition)
            });
        }
Пример #4
0
        // Token: 0x060004FD RID: 1277 RVA: 0x000321F8 File Offset: 0x000305F8
        protected override Job TryGiveJob(Pawn pawn)
        {
            Need_Food    food  = pawn.needs.food;
            LifeStageDef stage = pawn.ageTracker.CurLifeStage;

            if (stage == pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def)
            {
                return(null);
            }

            bool flag;

            if (pawn.AnimalOrWildMan())
            {
                flag = true;
            }
            else
            {
                Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Malnutrition, false);
                flag = (firstHediffOfDef != null && firstHediffOfDef.Severity > 0.4f);
            }
            bool     flag2     = pawn.needs.food.CurCategory == HungerCategory.Starving;
            bool     desperate = flag2;
            Thing    thing;
            ThingDef thingDef;
            bool     canRefillDispenser = false;
            bool     canUseInventory    = false;
            bool     allowCorpse        = true;
            bool     flag3 = false;

            if (pawn.GetLord() != null && pawn.GetLord() is Lord L)
            {
                if (L.CurLordToil is LordToil_DefendAndExpandHiveLike Hivelord)
                {
                    if (Hivelord.Data.assignedHiveLikes.TryGetValue(pawn) != null)
                    {
                        if (!Hivelord.Data.assignedHiveLikes.TryGetValue(pawn).active)
                        {
                            return(null);
                        }
                    }
                }
            }
            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate, out thing, out thingDef, canRefillDispenser, canUseInventory, true, allowCorpse, true, pawn.IsWildMan(), flag3))
            {
                return(null);
            }
            if (thing.GetType() != typeof(Corpse))
            {
                return(null);
            }
            Pawn pawn2 = thing as Pawn;

            if (pawn2 != null && pawn.CanSee(pawn2) && pawn.isXenomorph())
            {
                return(new Job(JobDefOf.PredatorHunt, pawn2)
                {
                    killIncappedTarget = true
                });
            }
            float nutrition = FoodUtility.GetNutrition(thing, thingDef);

            return(new Job(XenomorphDefOf.RRY_Neomorph_Ingest, thing)
            {
                count = FoodUtility.WillIngestStackCountOf(pawn, thingDef, nutrition)
            });
        }