public static void Postfix(ref IEnumerable <Pawn> __result, IIncidentTarget target) { var newList = __result.ToList(); newList.RemoveAll(pawn => PeacekeeperUtility.IsPeacekeeper(pawn)); __result = newList; }
public static void Postfix(ref Thought_Memory __result, Corpse __instance) { if (__result != null && PeacekeeperUtility.IsPeacekeeper(__instance.InnerPawn)) { __result = null; } }
public static bool Prefix(Need_Rest __instance, Pawn ___pawn, ref int ___ticksAtZero) { if (!PeacekeeperUtility.IsPeacekeeper(___pawn)) { return(true); } // todo add class to hediff that removes the hediff when energy is available var isFrozen = (bool)Traverse.Create(__instance).Property("IsFrozen").GetValue <bool>(); var malnutInt = MalnutritionSeverityPerInterval(___pawn); if (!isFrozen) { __instance.CurLevel -= __instance.RestFallPerTick * 150f; } if (__instance.CurLevel < 0.0001f) { ___ticksAtZero += 150; } else { ___ticksAtZero = 0; } if (___ticksAtZero > 1000) { HealthUtility.AdjustSeverity(___pawn, RSDefOf.RSEnergyShortage, malnutInt * ModSettings.energyShortageSeverityMult); } else { HealthUtility.AdjustSeverity(___pawn, RSDefOf.RSEnergyShortage, -malnutInt); } return(false); }
public static void Postfix(ref string __result, Need __instance, Pawn ___pawn) { if (!PeacekeeperUtility.IsPeacekeeper(___pawn)) { return; } if (__instance.def.defName == "Rest") { __result = string.Concat(new string[] { __instance.LabelCap, ": ", __instance.CurLevelPercentage.ToStringPercent(), " (", __instance.CurLevel.ToString("0.##"), " / ", __instance.MaxLevel.ToString("0.##"), ")\n", "RSEnergyDesc".Translate() } ); } else if ((new string[] { "Joy", "Comfort", "Beauty", "Outdoors", "Mood" }).Contains(__instance.def.defName)) { __result = string.Empty; } }
public static void Postfix(ref Job __result, Pawn pawn, float ___radius) { if (__result != null) { return; } Predicate <Thing> validator = delegate(Thing t) { Pawn pawn3 = (Pawn)t; return(pawn3.Downed && pawn3.Faction == pawn.Faction && !pawn3.InBed() && pawn.CanReserve(pawn3, 1, -1, null, false) && !pawn3.IsForbidden(pawn) && !GenAI.EnemyIsNear(pawn3, 25f)); }; Pawn pawn2 = (Pawn)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), ___radius, validator, null, 0, -1, false, RegionType.Set_Passable, false); if (pawn2 == null) { return; } if (!PeacekeeperUtility.IsPeacekeeper(pawn2) || PeacekeeperUtility.IsInChargeStation(pawn2)) { return; } var building_Bed = PeacekeeperUtility.GetEmptyChargeStation(pawn2); if (building_Bed == null || !pawn2.CanReserve(building_Bed, 1, -1, null, false) || building_Bed.IsForbidden(pawn)) { return; } Job job = JobMaker.MakeJob(RSDefOf.RSRescueToChargeStation, pawn2, building_Bed); job.count = 1; __result = job; }
public static bool Prefix(Pawn victim, DamageInfo?dinfo, PawnDiedOrDownedThoughtsKind thoughtsKind, List <IndividualThoughtToAdd> outIndividualThoughts, List <ThoughtToAddToAll> outAllColonistsThoughts) { if (!PeacekeeperUtility.IsPeacekeeper(victim)) { return(true); } return(false); }
public static void Postfix(Pawn pawn, Caravan ___caravan) { if (pawn.Dead || !PeacekeeperUtility.IsPeacekeeper(pawn)) { return; } PeacekeeperUtility.RefuelPawnOnCaravan(pawn, ___caravan); }
public static bool Prefix(Pawn ___pawn) { if (PeacekeeperUtility.IsPeacekeeper(___pawn)) { return(false); } return(true); }
public static void JobGiver_Bedtime_TryGiveJob_Postfix(ref Job __result, Pawn pawn) { if (__result == null || !PeacekeeperUtility.IsPeacekeeper(pawn)) { return; } __result = null; }
public static void guardNeedBladder_Postfix(ref bool __result, Pawn pawn) { if (!PeacekeeperUtility.IsPeacekeeper(pawn)) { return; } __result = false; }
public static void ShipInteriorMod2_hasSpaceSuit_Postfix(ref bool __result, Pawn pawn) { if (__result == true || !PeacekeeperUtility.IsPeacekeeper(pawn)) { return; } __result = true; }
public static bool Need_Treatment_NeedInterval_Prefix(Pawn ___pawn) { if (!PeacekeeperUtility.IsPeacekeeper(___pawn)) { return(true); } return(false); }
public static bool Prefix(ref bool __result, Pawn p) { if (!PeacekeeperUtility.IsPeacekeeper(p)) { return(true); } __result = false; return(false); }
public static bool JobGiver_Labor_TryIssueJobPackage_Prefix(ref ThinkResult __result, Pawn pawn) { if (!PeacekeeperUtility.IsPeacekeeper(pawn)) { return(true); } __result = ThinkResult.NoJob; return(false); }
public static void Postfix(ref string __result, Need __instance, Pawn ___pawn) { if (__instance.def.defName == "Rest" && PeacekeeperUtility.IsPeacekeeper(___pawn)) { __result = "RSEnergyLabel".Translate(); } else if ((new string[] { "Joy", "Comfort", "Beauty", "Outdoors", "Mood" }).Contains(__instance.def.defName) && PeacekeeperUtility.IsPeacekeeper(___pawn)) { __result = string.Empty; } }
public static void Postfix(ref Job __result, Pawn pawn) { if (__result == null) { return; } if (PeacekeeperUtility.IsPeacekeeper(pawn)) { __result = null; } }
public static void Postfix(ref bool __result, Pawn pawn, InteractionDef interactionDef = null) { if (!__result) { return; } if (PeacekeeperUtility.IsPeacekeeper(pawn)) { __result = false; } }
public static void Postfix(ref bool __result, Pawn p) { if (!__result) { return; } if (PeacekeeperUtility.IsPeacekeeper(p)) { __result = false; } }
public static void Postfix(ref ThoughtState __result, Pawn p, Pawn otherPawn) { if (!ModSettings.removeIdeologyImpact || __result.StageIndex == ThoughtState.Inactive.StageIndex) { return; } if (PeacekeeperUtility.IsPeacekeeper(p) || PeacekeeperUtility.IsPeacekeeper(otherPawn)) { __result = false; } }
//public static bool JobGiver_Labor__TryIssueJobPackage_Postfix(ref ThinkResult __result, Pawn pawn) //{ // if (!PeacekeeperUtility.IsPeacekeeper(pawn)) return true; // __result = ThinkResult.NoJob; // return false; //} public static bool WorkSettings_InitWorkSettings_Prefix(Pawn pawn) { if (!PeacekeeperUtility.IsPeacekeeper(pawn)) { return(true); } if (pawn?.playerSettings?.AreaRestriction != null) { pawn.playerSettings.AreaRestriction = null; } return(false); }
public static void Postfix(ref bool __result, Pawn pawn, Thing t, bool forced = false) { if (!__result) { return; } Pawn pawn2 = t as Pawn; if (!PeacekeeperUtility.IsPeacekeeper(pawn2)) { return; } __result = false; }
public static void Postfix(ref string __result, PawnCapacityDef __instance, Pawn pawn) { if (!PeacekeeperUtility.IsPeacekeeper(pawn)) { return; } if (__instance == PawnCapacityDefOf.BloodFiltration) { __result = "RSCoolantFiltration".Translate(); } if (__instance == PawnCapacityDefOf.BloodPumping) { __result = "RSCoolantCirculation".Translate(); } }
// todo - may need some revision public static void Postfix(ref bool __result, Thing bedThing, Pawn sleeper) { if (PeacekeeperUtility.IsPeacekeeper(sleeper) && bedThing.def == RSDefOf.RSChargeStation) { __result = true; } else if (PeacekeeperUtility.IsPeacekeeper(sleeper) && bedThing.def != RSDefOf.RSChargeStation) { __result = false; } else if (bedThing.def == RSDefOf.RSChargeStation) { __result = false; } }
public static void Postfix(ref bool __result, Pawn pawn, Thing t, bool forced = false) { Pawn pawn2 = t as Pawn; if (!PeacekeeperUtility.IsPeacekeeper(pawn2)) { return; } if (!pawn2.Downed || pawn2.Faction != Faction.OfPlayer || PeacekeeperUtility.IsInChargeStation(pawn2) || !pawn.CanReserve(pawn2) || GenAI.EnemyIsNear(pawn2, 40f)) { __result = false; return; } var chargeStation = PeacekeeperUtility.GetEmptyChargeStation(pawn2); __result = chargeStation != null && pawn2.CanReserve(chargeStation, 1, -1, null, false); }
public static void Postfix(ref Job __result, Pawn pawn, Thing t, bool forced = false) { Pawn pawn2 = t as Pawn; if (!PeacekeeperUtility.IsPeacekeeper(pawn2) || PeacekeeperUtility.IsInChargeStation(pawn2) || !pawn.CanReserve(t)) { return; } Thing t2 = PeacekeeperUtility.GetEmptyChargeStation(pawn2); if (t2 == null) { return; } Job job = JobMaker.MakeJob(RSDefOf.RSRescueToChargeStation, pawn2, t2); job.count = 1; __result = job; }
public static void Pawn_NeedsTracker_ShouldHaveNeed_Postfix(Pawn_NeedsTracker __instance, ref bool __result, Pawn ___pawn, NeedDef nd) { if (!__result) { return; } if (!PeacekeeperUtility.IsPeacekeeper(___pawn)) { return; } var t = PatchesCompatibility.hygieneAssembly.GetType("DubsBadHygiene.NeedsUtil"); var checkInfo = t.GetMethod("IsHygieneNeed", new[] { typeof(NeedDef) }); var isHygieneNeed = (bool)checkInfo.Invoke(null, new object[] { nd }); if (!isHygieneNeed) { return; } __result = false; }
public static void StorytellerUtilityPopulation_AdjustedPopulation_get_Postfix(ref float __result) { var robotCount = PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists?.Where(colonist => PeacekeeperUtility.IsPeacekeeper(colonist))?.Count(); if (robotCount == null) { return; } __result -= (int)robotCount; }
public static void ColonistBar_CheckRecacheEntries_Postfix(List <ColonistBar.Entry> ___cachedEntries) { ___cachedEntries.RemoveAll(entry => PeacekeeperUtility.IsPeacekeeper(entry.pawn)); }
public static void Postfix(ref bool __result, Caravan __instance) { if (!__result) { return; } var peaceKeeperCount = __instance.pawns.InnerListForReading.Where(pawn => PeacekeeperUtility.IsPeacekeeper(pawn)).Count(); if (peaceKeeperCount == __instance.pawns.Count) { __result = false; } }
public static void Postfix(Pawn __instance, Pawn butcher, float efficiency) { ModSettings.butcheredPeacekeeper = PeacekeeperUtility.IsPeacekeeper(__instance); }