From 5dc542a945029da926a07d962ff15e8aa3302a31 Mon Sep 17 00:00:00 2001 From: Arne Kiesewetter Date: Fri, 2 Aug 2024 23:08:37 +0200 Subject: [PATCH] Make ConfigKeySessionShare more resilient --- .../Configuration/ConfigKeySessionShare.cs | 8 +------- .../MonkeyLoader.Resonite.Integration.csproj | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/MonkeyLoader.Resonite.Integration/Configuration/ConfigKeySessionShare.cs b/MonkeyLoader.Resonite.Integration/Configuration/ConfigKeySessionShare.cs index 4ed68a2..80def15 100644 --- a/MonkeyLoader.Resonite.Integration/Configuration/ConfigKeySessionShare.cs +++ b/MonkeyLoader.Resonite.Integration/Configuration/ConfigKeySessionShare.cs @@ -18,7 +18,6 @@ namespace MonkeyLoader.Resonite.Configuration /// The type of the config item's value. public sealed class ConfigKeySessionShare : IConfigKeySessionShare { - private readonly ConditionalWeakTable _didWorldSetup = new(); private readonly Lazy _sharedId; private readonly Lazy _variableName; private IDefiningConfigKey _configKey = null!; @@ -134,13 +133,10 @@ private ValueUserOverride GetSharedOverride(World world) => GetSharedValue(world).Value.GetUserOverride(); private ValueField GetSharedValue(World world) - => world.GetSharedComponentOrCreate>(SharedId, SetupSharedField, 0, true, true, () => GetSharedConfigSlot(world)); + => world.GetSharedComponentOrCreate>(SharedId, SetupSharedField, 0, true, false, () => GetSharedConfigSlot(world)); private void SetupSharedField(ValueField field) { - if (_didWorldSetup.TryGetValue(field.World, out _)) - return; - if (!field.IsDriven && EqualityComparer.Default.Equals(field.Value, default!)) field.Value.Value = DefaultValue!; @@ -150,8 +146,6 @@ private void SetupSharedField(ValueField field) vuo.CreateOverrideOnWrite.Value = true; field.Value.OnValueChange += SharedValueChanged; - - _didWorldSetup.TryAdd(field.World, null); } private void SharedValueChanged(SyncField field) diff --git a/MonkeyLoader.Resonite.Integration/MonkeyLoader.Resonite.Integration.csproj b/MonkeyLoader.Resonite.Integration/MonkeyLoader.Resonite.Integration.csproj index 2dd887b..8d84997 100644 --- a/MonkeyLoader.Resonite.Integration/MonkeyLoader.Resonite.Integration.csproj +++ b/MonkeyLoader.Resonite.Integration/MonkeyLoader.Resonite.Integration.csproj @@ -10,7 +10,7 @@ MonkeyLoader.GamePacks.Resonite Resonite Game Pack Banane9, Nytra - 0.18.0-beta + 0.18.0-beta-pre1 This Game Pack for MonkeyLoader provides basic hooks for modding the game Resonite, which uses FrooxEngine. It provides hooks for the beginning of initialization,