public static void LoadFlareups(GameInstanceSave gameInstanceSave, SimGameState __instance) { try { WIIC.sim = __instance; WIIC.modLog.Debug?.Write("Loading Flareups"); WIIC.flareups.Clear(); WIIC.sim.CompanyTags.Add("WIIC_enabled"); WIIC.readFromJson("WIIC_ephemeralSystemControl.json", true); foreach (StarSystem system in __instance.StarSystems) { string tag = system.Tags.ToList().Find(Flareup.isSerializedFlareup); if (tag != null) { system.Tags.Remove(tag); Flareup flareup = Flareup.Deserialize(tag); WIIC.flareups[system.ID] = flareup; } tag = system.Tags.ToList().Find(Utilities.isControlTag); if (tag != null) { system.Tags.Remove(tag); WIIC.systemControl[system.ID] = tag; } } WIIC.modLog.Debug?.Write($"Loaded {WIIC.flareups.Keys.Count} flareups and {WIIC.systemControl.Keys.Count} system control tags"); Utilities.redrawMap(); } catch (Exception e) { WIIC.modLog.Error?.Write(e); } }
public static void Postfix(SimGameState __instance) { try { WIIC.readFromJson("WIIC_systemControl.json", false); } catch (Exception e) { WIIC.modLog.Error?.Write(e); } }
public static void Postfix(SimGameState __instance) { try { WIIC.readFromJson(); } catch (Exception e) { WIIC.modLog.Error?.Write(e); } }