private static void WriteFireData(Fire __instance, string guid) { // create new instance if needed if (!FAD.ContainsKey(guid)) { FireAddonsData lFAD = new FireAddonsData(); FAD.Add(guid, lFAD); } FAD[guid].timestamp = GameManager.GetTimeOfDayComponent().GetTODSeconds(GameManager.GetTimeOfDayComponent().GetSecondsPlayedUnscaled()); FAD[guid].ver = FADSchema; FAD[guid].fireState = __instance.GetFireState().ToString(); FAD[guid].embersSeconds = __instance.m_EmberDurationSecondsTOD; FAD[guid].emberTimer = __instance.m_EmberTimer; FAD[guid].burnSeconds = __instance.m_ElapsedOnTODSeconds; FAD[guid].burnMaxSeconds = __instance.m_MaxOnTODSeconds; FAD[guid].heatTemp = __instance.m_HeatSource.m_MaxTempIncrease; }
internal static void LoadData(string name) { FAD.Clear(); fireFixed.Clear(); string data = SaveGameSlots.LoadDataFromSlot(name, SAVE_NAME); if (!string.IsNullOrEmpty(data)) { MelonLogger.Log("JSON loaded " + data); var foo = JSON.Load(data); foreach (var entry in foo as ProxyObject) { FireAddonsData lFAD = new FireAddonsData(); entry.Value.Populate(lFAD); FAD.Add(entry.Key, lFAD); } } }