// Token: 0x060004FC RID: 1276 RVA: 0x00032174 File Offset: 0x00030574 public override float GetPriority(Pawn pawn) { Need_Food food = pawn.needs.food; if (food == null) { return(0f); } /* * if (pawn.needs.food.CurCategory < HungerCategory.Starving && FoodUtility.ShouldBeFedBySomeone(pawn)) * { * return 0f; * } */ if (food.CurCategory < this.minCategory) { return(0f); } if (food.CurLevelPercentage < pawn.RaceProps.FoodLevelPercentageWantEat) { return(9.5f); } return(0f); }
protected override Job TryGiveJob(Pawn pawn) { Need_Food food = pawn.needs.food; Job result; if (food == null || food.CurCategory < this.minCategory) { result = null; } else { 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; ref Thing foodSource = ref thing; ThingDef thingDef; ref ThingDef foodDef = ref thingDef;
public override float GetPriority(Pawn pawn) { Need_Food food = pawn.needs.food; float result; if (food == null) { result = 0f; } else if (pawn.needs.food.CurCategory < HungerCategory.Starving && FoodUtility.ShouldBeFedBySomeone(pawn)) { result = 0f; } else if (food.CurCategory < this.minCategory) { result = 0f; } else if (food.CurLevelPercentage < pawn.RaceProps.FoodLevelPercentageWantEat) { result = 9.5f; } else { result = 0f; } return(result); }
public override float GetPriority(Pawn pawn) { Need_Food food = pawn.needs.food; if (food == null) { return(0f); } if ((int)pawn.needs.food.CurCategory < 3 && FoodUtility.ShouldBeFedBySomeone(pawn)) { return(0f); } if ((int)food.CurCategory < (int)minCategory) { return(0f); } if (food.CurLevelPercentage > maxLevelPercentage) { return(0f); } if (food.CurLevelPercentage < pawn.RaceProps.FoodLevelPercentageWantEat) { return(9.5f); } return(0f); }
private void BindDirectNeedFields() { this.mood = this.TryGetNeed <Need_Mood>(); this.food = this.TryGetNeed <Need_Food>(); this.rest = this.TryGetNeed <Need_Rest>(); this.joy = this.TryGetNeed <Need_Joy>(); this.beauty = this.TryGetNeed <Need_Beauty>(); this.comfort = this.TryGetNeed <Need_Comfort>(); this.space = this.TryGetNeed <Need_Space>(); }
private void BindDirectNeedFields() { mood = TryGetNeed <Need_Mood>(); food = TryGetNeed <Need_Food>(); rest = TryGetNeed <Need_Rest>(); joy = TryGetNeed <Need_Joy>(); beauty = TryGetNeed <Need_Beauty>(); comfort = TryGetNeed <Need_Comfort>(); roomsize = TryGetNeed <Need_RoomSize>(); outdoors = TryGetNeed <Need_Outdoors>(); }
private void BindDirectNeedFields() { this.mood = this.TryGetNeed <Need_Mood>(); this.food = this.TryGetNeed <Need_Food>(); this.rest = this.TryGetNeed <Need_Rest>(); this.joy = this.TryGetNeed <Need_Joy>(); this.beauty = this.TryGetNeed <Need_Beauty>(); this.comfort = this.TryGetNeed <Need_Comfort>(); this.roomsize = this.TryGetNeed <Need_RoomSize>(); this.outdoors = this.TryGetNeed <Need_Outdoors>(); }
private void BindDirectNeedFields() { mood = TryGetNeed <Need_Mood>(); food = TryGetNeed <Need_Food>(); rest = TryGetNeed <Need_Rest>(); joy = TryGetNeed <Need_Joy>(); beauty = TryGetNeed <Need_Beauty>(); comfort = TryGetNeed <Need_Comfort>(); roomsize = TryGetNeed <Need_RoomSize>(); outdoors = TryGetNeed <Need_Outdoors>(); drugsDesire = TryGetNeed <Need_Chemical_Any>(); authority = null; }
// 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) }); }
protected override Job TryGiveJob(Pawn pawn) { Need_Food food = pawn.needs.food; if (food == null || food.CurCategory < this.minCategory) { 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; bool canRefillDispenser = true; bool canUseInventory = true; bool allowCorpse = flag; bool flag3 = this.forceScanWholeMap; Thing thing; ThingDef thingDef; if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate, out thing, out thingDef, canRefillDispenser, canUseInventory, false, allowCorpse, false, pawn.IsWildMan(), flag3)) { return(null); } Pawn pawn2 = thing as Pawn; if (pawn2 != null) { return(new Job(JobDefOf.PredatorHunt, pawn2) { killIncappedTarget = true }); } if (thing is Plant && thing.def.plant.harvestedThingDef == thingDef) { return(new Job(JobDefOf.Harvest, thing)); } Building_NutrientPasteDispenser building_NutrientPasteDispenser = thing as Building_NutrientPasteDispenser; if (building_NutrientPasteDispenser != null && !building_NutrientPasteDispenser.HasEnoughFeedstockInHoppers()) { Building building = building_NutrientPasteDispenser.AdjacentReachableHopper(pawn); if (building != null) { ISlotGroupParent hopperSgp = building as ISlotGroupParent; Job job = WorkGiver_CookFillHopper.HopperFillFoodJob(pawn, hopperSgp); if (job != null) { return(job); } } thing = FoodUtility.BestFoodSourceOnMap(pawn, pawn, flag2, out thingDef, FoodPreferability.MealLavish, false, !pawn.IsTeetotaler(), false, false, false, false, false, false, this.forceScanWholeMap); if (thing == null) { return(null); } } float nutrition = FoodUtility.GetNutrition(thing, thingDef); return(new Job(JobDefOf.Ingest, thing) { count = FoodUtility.WillIngestStackCountOf(pawn, thingDef, nutrition) }); }
protected override Job TryGiveJob(Pawn pawn) { Need_Food food = pawn.needs.food; if (food == null || (int)food.CurCategory < (int)minCategory) { return(null); } bool flag; if (pawn.AnimalOrWildMan()) { flag = true; } else { Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Malnutrition); flag = (firstHediffOfDef != null && firstHediffOfDef.Severity > 0.4f); } bool flag2 = pawn.needs.food.CurCategory == HungerCategory.Starving; bool desperate = flag2; bool canRefillDispenser = true; bool canUseInventory = true; bool allowCorpse = flag; bool flag3 = forceScanWholeMap; Thing foodSource = default(Thing); ThingDef foodDef = default(ThingDef); if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate, out foodSource, out foodDef, canRefillDispenser, canUseInventory, allowForbidden: false, allowCorpse, allowSociallyImproper: false, pawn.IsWildMan(), flag3)) { return(null); } Pawn pawn2 = foodSource as Pawn; if (pawn2 != null) { Job job = new Job(JobDefOf.PredatorHunt, pawn2); job.killIncappedTarget = true; return(job); } if (foodSource is Plant && foodSource.def.plant.harvestedThingDef == foodDef) { return(new Job(JobDefOf.Harvest, foodSource)); } Building_NutrientPasteDispenser building_NutrientPasteDispenser = foodSource as Building_NutrientPasteDispenser; if (building_NutrientPasteDispenser != null && !building_NutrientPasteDispenser.HasEnoughFeedstockInHoppers()) { Building building = building_NutrientPasteDispenser.AdjacentReachableHopper(pawn); if (building != null) { ISlotGroupParent hopperSgp = building as ISlotGroupParent; Job job2 = WorkGiver_CookFillHopper.HopperFillFoodJob(pawn, hopperSgp); if (job2 != null) { return(job2); } } foodSource = FoodUtility.BestFoodSourceOnMap(pawn, pawn, flag2, out foodDef, FoodPreferability.MealLavish, allowPlant: false, !pawn.IsTeetotaler(), allowCorpse: false, allowDispenserFull: false, allowDispenserEmpty: false, allowForbidden: false, allowSociallyImproper: false, allowHarvest: false, forceScanWholeMap); if (foodSource == null) { return(null); } } float nutrition = FoodUtility.GetNutrition(foodSource, foodDef); Job job3 = new Job(JobDefOf.Ingest, foodSource); job3.count = FoodUtility.WillIngestStackCountOf(pawn, foodDef, nutrition); return(job3); }
// 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) }); }