public static void Prefix(SimGameState __instance, SimGameSave save, ref SerializableReferenceContainer references) { Contract selectedContract = __instance.SelectedContract; if (selectedContract == null || __instance.BattleTechGame.Combat != null) { return; } references.AddItem(ModSettings.MOD_SAVE_REFERENCECONTAINER_KEY, selectedContract); }
public static bool Prefix(AbstractActor __instance, SerializableReferenceContainer references, ref bool ___underscoreIsShutDown, bool ____isShutDown, ref string ___underscoreLanceID, string ____lanceId, ref string ___underscoreSpawnerID, string ____spawnerId, ref string ___underscoreTeamID, string ____teamId, ref bool ___serializableHasHandledDeath, ref int ___serializableDeathLocation, int ____deathLocation, ref DeathMethod ___serializableDeathMethod, DeathMethod ____deathMethod, Team ____team, List <Weapon> ___weapons ) { //SkillBasedInit.Logger.Log($"AbstractActor:Dehydrate - preventing native call to allow serialization of initiative"); ___underscoreIsShutDown = ____isShutDown; ___underscoreLanceID = ____lanceId; ___underscoreSpawnerID = ____spawnerId; ___underscoreTeamID = ____teamId; ___serializableHasHandledDeath = __instance.HasHandledDeath; ___serializableDeathLocation = ____deathLocation; ___serializableDeathMethod = ____deathMethod; references.AddItem <Team>(__instance, "_team", ____team); if (__instance.BehaviorTree != null) { __instance.BehaviorTree.Dehydrate(references); } references.AddItemList <Weapon>(__instance, "Weapons", ___weapons); references.AddItemList <AmmunitionBox>(__instance, "AmmoBox", __instance.ammoBoxes); references.AddItemList <Jumpjet>(__instance, "JumpJets", __instance.jumpjets); references.AddItem <Weapon>(__instance, "ImaginaryLaser", __instance.ImaginaryLaserWeapon); if (!(__instance.Initiative > 0 && __instance.Initiative < (Mod.MaxPhase + 1))) { Mod.Log.Info(string.Format("Saving an AbstractActor of type {0} with an invalid initiative of {1}", __instance.ClassName, __instance.Initiative)); } return(false); }
public static void SaveShops(SerializableReferenceContainer references) { Control.LogDebug(DInfo.SaveLoad, "Saving Shops"); foreach (var shop in Control.Shops) { if (shop is ISaveShop save) { Control.LogDebug(DInfo.SaveLoad, "- " + shop.Name); var shop_to_save = save.GetShopToSave(); if (shop_to_save != null) { references.AddItem <Shop>("Shop" + shop.Name, shop_to_save); Control.LogDebug(DInfo.SaveLoad, "-- Saved as Shop" + shop.Name); } else { Control.LogDebug(DInfo.SaveLoad, "-- no shop to save"); } } } }