//actually instead of transpiling the PostMapInit call, just do the same loop with this postfix public static void Postfix(Map __instance) { foreach (Thing current in __instance.listerThings.AllThings.ToList <Thing>()) { RestoreHPToSafeItem.Restore(current); } }
//public override void SpawnSetup(Map map, bool respawningAfterLoad) public static void Postfix(Thing __instance, Map map, bool respawningAfterLoad) { if (map.regionAndRoomUpdater.Enabled) { RestoreHPToSafeItem.Restore(__instance, map); } }
//public void Notify_RoomShapeOrContainedBedsChanged() public static void Postfix(District __instance) { if (__instance.Room.UsesOutdoorTemperature) { return; } Map map = __instance.Map; foreach (Thing t in __instance.Room.ContainedAndAdjacentThings) { RestoreHPToSafeItem.Restore(t, map); } }
//public void SetRoof(IntVec3 c, RoofDef def) public static void Postfix(RoofGrid __instance, IntVec3 c, RoofDef def, Map ___map) { if (def == null) { return; } Map map = ___map; if (map == null || map.thingGrid == null || !map.regionAndRoomUpdater.Enabled) { return; } foreach (Thing t in map.thingGrid.ThingsAt(c)) { RestoreHPToSafeItem.Restore(t, map); } }
//public virtual bool TryAbsorbStack(Thing other, bool respectStackLimit) public static void Postfix(Thing __instance) { RestoreHPToSafeItem.Restore(__instance); }