private static void LookInternalDef <T>(ref T obj, string label, LookMode lookMode) where T : Def, new() { Scribe_Defs.Look(ref obj, label); }
public override void PostExposeData(object obj) { if (Scribe.mode == LoadSaveMode.LoadingVars) { Game game = obj as Game; if (game != null && game.battleLog == null) { game.battleLog = new BattleLog(); } BattleLogEntry_MeleeCombat battleLogEntry_MeleeCombat = obj as BattleLogEntry_MeleeCombat; if (battleLogEntry_MeleeCombat != null) { if (battleLogEntry_MeleeCombat.RuleDef == null) { RulePackDef value = null; RulePackDef value2 = null; Scribe_Defs.Look(ref value, "outcomeRuleDef"); Scribe_Defs.Look(ref value2, "maneuverRuleDef"); if (value != null && value2 != null) { foreach (RulePackDef item in DefDatabase <RulePackDef> .AllDefsListForReading) { if (!item.include.NullOrEmpty() && item.include.Count == 2 && ((item.include[0] == value && item.include[1] == value2) || (item.include[1] == value && item.include[0] == value2))) { battleLogEntry_MeleeCombat.RuleDef = item; break; } } } } if (battleLogEntry_MeleeCombat.def == null) { battleLogEntry_MeleeCombat.def = LogEntryDefOf.MeleeAttack; } } } if (Scribe.mode == LoadSaveMode.PostLoadInit) { Map map = obj as Map; if (map != null && map.pawnDestinationReservationManager == null) { map.pawnDestinationReservationManager = new PawnDestinationReservationManager(); } Pawn pawn = obj as Pawn; if (pawn != null && pawn.Spawned && pawn.rotationTracker == null) { pawn.rotationTracker = new Pawn_RotationTracker(pawn); } Pawn_MindState pawn_MindState = obj as Pawn_MindState; if (pawn_MindState != null && pawn_MindState.inspirationHandler == null) { pawn_MindState.inspirationHandler = new InspirationHandler(pawn_MindState.pawn); } ImportantPawnComp importantPawnComp = obj as ImportantPawnComp; if (importantPawnComp != null && importantPawnComp.pawn == null) { importantPawnComp.pawn = new ThingOwner <Pawn>(importantPawnComp, oneStackOnly: true); } Pawn_RecordsTracker pawn_RecordsTracker = obj as Pawn_RecordsTracker; if (pawn_RecordsTracker != null && Find.TaleManager.AnyTaleConcerns(pawn_RecordsTracker.pawn)) { pawn_RecordsTracker.AccumulateStoryEvent(StoryEventDefOf.TaleCreated); } WorldPawns worldPawns = obj as WorldPawns; if (worldPawns != null && worldPawns.gc == null) { worldPawns.gc = new WorldPawnGC(); } GameCondition gameCondition = obj as GameCondition; if (gameCondition != null && !gameCondition.Permanent && gameCondition.Duration > 1000000000) { gameCondition.Permanent = true; } Building_TurretGun building_TurretGun = obj as Building_TurretGun; if (building_TurretGun != null && building_TurretGun.gun == null) { building_TurretGun.MakeGun(); } } }