make everything in QSBWorldSync readonly, just for fun

This commit is contained in:
JohnCorby 2022-01-29 15:33:33 -08:00
parent d703465a35
commit 0cb8b48b71

View File

@ -1,4 +1,5 @@
using Cysharp.Threading.Tasks;
using MonoMod.Utils;
using OWML.Common;
using QSB.ConversationSync.Patches;
using QSB.LogSync;
@ -133,10 +134,10 @@ namespace QSB.WorldSync
// =======================================================================================================
public static List<CharacterDialogueTree> OldDialogueTrees { get; } = new();
public static Dictionary<string, bool> DialogueConditions { get; private set; } = new();
private static Dictionary<string, bool> PersistentConditions { get; set; } = new();
public static List<FactReveal> ShipLogFacts { get; } = new();
public static readonly List<CharacterDialogueTree> OldDialogueTrees = new();
public static readonly Dictionary<string, bool> DialogueConditions = new();
private static readonly Dictionary<string, bool> PersistentConditions = new();
public static readonly List<FactReveal> ShipLogFacts = new();
private static readonly List<IWorldObject> WorldObjects = new();
private static readonly Dictionary<MonoBehaviour, IWorldObject> UnityObjectsToWorldObjects = new();
@ -154,7 +155,8 @@ namespace QSB.WorldSync
}
DebugLog.DebugWrite($"DIALOGUE CONDITIONS :");
DialogueConditions = new(DialogueConditionManager.SharedInstance._dictConditions);
DialogueConditions.Clear();
DialogueConditions.AddRange(DialogueConditionManager.SharedInstance._dictConditions);
foreach (var item in DialogueConditions)
{
DebugLog.DebugWrite($"- {item.Key}, {item.Value}");
@ -163,7 +165,8 @@ namespace QSB.WorldSync
DebugLog.DebugWrite($"PERSISTENT CONDITIONS :");
var dictConditions = PlayerData._currentGameSave.dictConditions;
var syncedConditions = dictConditions.Where(x => ConversationPatches.PersistentConditionsToSync.Contains(x.Key));
PersistentConditions = syncedConditions.ToDictionary(x => x.Key, x => x.Value);
PersistentConditions.Clear();
PersistentConditions.AddRange(syncedConditions.ToDictionary(x => x.Key, x => x.Value));
foreach (var item in PersistentConditions)
{
DebugLog.DebugWrite($"- {item.Key}, {item.Value}");