static void Postfix(CompAssignableToPawn __instance, ref int __result) { if (__instance.parent is Building_BaseMechanoidPlatform) { __result = 1; } }
static void Postfix(ref IEnumerable <Pawn> __result, ref CompAssignableToPawn __instance) { if (__instance.parent == null || !(__instance.parent is Building_Bed)) { return; } Building_Bed bed = (Building_Bed)__instance.parent; if (bed.Faction != Faction.OfPlayer || bed.def.building.bed_humanlike) { return; } if (bed.def.building.bed_maxBodySize <= 0.01) { return; // bodysize check is for compatibility with Dubs Hygiene - he made his bathtubs as animal beds. } if (bed.GetType().Name == "Building_MechanoidPlatform" || bed.GetType().Name == "Building_PortableChargingPlatform" || bed.def.designationCategory.defName == "WTH_Hacking") { return; // for some other mods } if (!bed.Spawned) { __result = Enumerable.Empty <Pawn>(); return; } __result = from p in Find.CurrentMap.mapPawns.AllPawns where p.RaceProps.Animal && p.Faction == Faction.OfPlayer select p; }
static void Postfix(CompAssignableToPawn __instance, ref bool __result) { if (__instance.parent is Building_BaseMechanoidPlatform || __instance.parent is Building_HackingTable) { __result = false; } }
public static void Postfix(CompAssignableToPawn __instance) { if (__instance?.parent?.def?.IsBed ?? false) { __instance.parent.Map?.reachability?.ClearCache(); LockConfig.Notify_Dirty(); } }
public static void Listener(ref IEnumerable <Pawn> __result, CompAssignableToPawn __instance) { IEnumerable <Pawn> pawns = __result as Pawn[] ?? __result.ToArray(); var orig = pawns; try { var bed = (Building_Bed)__instance.parent; switch (bed.def.defName) { case "ATPP_AndroidPod": { var lst = pawns.Where(el => el.def.defName != Utils.M7 && el.IsAndroidTier()).ToList(); if (Settings.hideInactiveSurrogates) { addInactiveSurrogates(ref lst, bed.Map, false); } __result = lst; break; } case "ATPP_AndroidPodMech": { var lst = pawns.Where(el => el.def.defName == Utils.M7).ToList(); if (Settings.hideInactiveSurrogates) { addInactiveSurrogates(ref lst, bed.Map, false); } __result = lst; break; } default: { if (bed.def.defName != "SleepingSpot") { var lst = pawns.Where(el => !el.IsAndroidTier()).ToList(); __result = lst; } break; } } } catch (Exception e) { __result = orig; Log.Message("[ATPP] Building_Bed get_AssigningCandidates" + e.Message + " " + e.StackTrace); } }
static bool Prefix(ref IEnumerable <Pawn> __result, CompAssignableToPawn __instance) { Building_Bed bed = __instance.parent as Building_Bed; if (bed != null && bed.Spawned && __instance is CompAssignableToPawn_Bed && bed.ForPrisoners) { __result = bed.Map.mapPawns.PrisonersOfColony; return(false); } return(true); }
static bool Prefix(CompAssignableToPawn __instance, ref IEnumerable <Pawn> __result) { if (__instance.parent is Building_BaseMechanoidPlatform) { if (!__instance.parent.Spawned) { __result = Enumerable.Empty <Pawn>(); } __result = __instance.parent.Map.mapPawns.AllPawns.Where((Pawn p) => p.IsHacked()); return(false); } return(true); }
public override void TickLong() { UpdateStats(); // Remove owners that weren't properly cleared foreach (var pawn in CompAssignableToPawn.AssignedPawnsForReading.ToArray()) { if (pawn == null || !pawn.Spawned || pawn.Dead) { CompAssignableToPawn.TryUnassignPawn(pawn); } } }
private static void Postfix(ref IEnumerable <Pawn> __result, CompAssignableToPawn __instance) { if (__instance.parent.Spawned) { var list = __result.ToList(); foreach (var map in ZUtils.ZTracker.GetAllMaps(__instance.parent.Map.Tile)) { if (map != __instance.parent.Map) { list.AddRange(map.mapPawns.FreeColonists); } } __result = list; } }
static bool Prefix(CompAssignableToPawn __instance, ref IEnumerable <Pawn> __result) { if (__instance.parent is Building_BaseMechanoidPlatform) { Log.Message("get_AssigningCandidates patch called"); if (!__instance.parent.Spawned) { __result = Enumerable.Empty <Pawn>(); } __result = __instance.parent.Map.mapPawns.AllPawns.Where((Pawn p) => p.IsHacked()); return(false); } Log.Message("get_AssigningCandidates patch skipped"); return(true); }
static bool Prefix(ref IEnumerable <Pawn> __result, CompAssignableToPawn __instance) { var bed = __instance.parent as Building_Bed; if (bed == null || !bed.Spawned || bed.ForPrisoners || bed.Map == null) { return(true); } // Allow selecting any colonist on permanent bases if (bed.Map.IsPlayerHome) { __result = Find.ColonistBar.GetColonistsInOrder(); // Doesn't feel like the correct way to do this return(false); } return(true); }
static bool Prefix(ref IEnumerable <Pawn> __result, CompAssignableToPawn __instance) { var bed = __instance.parent as Building_Bed; if (!Helpers.ShouldRunForBed(bed)) { return(true); } // Allow selecting any colonist on permanent bases if (bed.Map.IsPlayerHome) { __result = Find.ColonistBar.GetColonistsInOrder(); return(false); } return(true); }
public static void Listener(ref IEnumerable <Pawn> __result, CompAssignableToPawn __instance) { IEnumerable <Pawn> orig = __result; try { Building_Bed bed = (Building_Bed)__instance.parent; if (bed.def.defName == "ATPP_AndroidPod") { List <Pawn> lst = new List <Pawn>(); foreach (var el in __result) { if (el.IsAndroidTier()) { lst.Add(el); } } __result = lst; } else if (bed.def.defName != "SleepingSpot") { List <Pawn> lst = new List <Pawn>(); foreach (var el in __result) { if (!el.IsAndroidTier()) { lst.Add(el); } } __result = lst; } } catch (Exception e) { __result = orig; Log.Message("[ATPP] Building_Bed get_AssigningCandidates" + e.Message + " " + e.StackTrace); } }
public static void Listener(ref IEnumerable <Pawn> __result, CompAssignableToPawn __instance) { IEnumerable <Pawn> orig = __result; try { Building_Bed bed = (Building_Bed)__instance.parent; if (bed.def.defName == "ATPP_AndroidPod") { List <Pawn> lst = new List <Pawn>(); foreach (var el in __result) { if (el.def.defName != Utils.M7 && el.IsAndroidTier()) { lst.Add(el); } } //Si option masquant les surrogates activé alors ajout de ces derniers à la fin if (Settings.hideInactiveSurrogates) { addInactiveSurrogates(ref lst, bed.Map, false); } __result = lst; } else if (bed.def.defName == "ATPP_AndroidPodMech") { List <Pawn> lst = new List <Pawn>(); foreach (var el in __result) { if (el.def.defName == Utils.M7) { lst.Add(el); } } //Si option masquant les surrogates activé alors ajout de ces derniers à la fin if (Settings.hideInactiveSurrogates) { addInactiveSurrogates(ref lst, bed.Map, false); } __result = lst; } else if (bed.def.defName != "SleepingSpot") { List <Pawn> lst = new List <Pawn>(); foreach (var el in __result) { if (!el.IsAndroidTier()) { lst.Add(el); } } __result = lst; } } catch (Exception e) { __result = orig; Log.Message("[ATPP] Building_Bed get_AssigningCandidates" + e.Message + " " + e.StackTrace); } }
public static IEnumerable <Pawn> PostFixCandidates(IEnumerable <Pawn> __result, CompAssignableToPawn __instance) { foreach (Pawn pawn in __result) { yield return(pawn); } if (__instance.parent.Spawned && __instance is CompAssignableToPawn_Shifts) { foreach (Pawn pawn in __instance.parent.Map.mapPawns.PrisonersOfColonySpawned) { yield return(pawn); } } }