diff --git a/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Lua/init.lua b/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Lua/init.lua
index 98d641dd8..0c6c821fc 100644
--- a/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Lua/init.lua
+++ b/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Lua/init.lua
@@ -24,29 +24,52 @@ Hook.Add("missionsEnded", "test", function()
print("missionsEnded")
end)
+-- cfg tests
+local str = "CLIENT: "
+
+if SERVER then
+ str = "SERVER: "
+end
+
+function OnChanged(cfg)
+ print(str, "cfg value for ", cfg.InternalName, " changed to ", cfg.Value)
+end
+
local failed, package = trygetpackage("[DebugOnlyTest]TestLuaMod")
print("packageFailed=", failed)
print("package", package.Name)
-local success, config = ConfigService.TryGetConfig(SettingBase.Single, package, "TestFloat")
+local success, config = ConfigService.TryGetConfig(SettingBase.Int32, package, "TestSynchroServer")
+local success2, config2 = ConfigService.TryGetConfig(SettingBase.Int32, package, "TestSynchroClient")
-local success2, config2 = ConfigService.TryGetConfig(SettingBase.Int32, package, "TestSynchroServer")
-local success3, config3 = ConfigService.TryGetConfig(SettingBase.Int32, package, "TestSynchroClient")
+if not success or not success2 then
+ print("Failed to get configs.")
+ return
+end
-print("config ", success, " ", config.Value)
-print("config testsynchrosrv", success2, " ", config2.Value)
-print("config testsynchrocli", success3, " ", config3.Value)
+config.OnValueChanged.add(OnChanged)
+config2.OnValueChanged.add(OnChanged)
-local lastTime = 0
+print(str, " testsynchroclient=", config2.Value)
+print(str, " testsynchroserver=", config.Value)
+
+-- The server should keep updating the value and it should show up on the client.
+-- The client should try updating and it should fail.
+
+local lastTime = Timer.Time + 30 -- give time to join
Hook.Add("think", "printconfig", function()
- if lastTime > Timer.Time then return end
+ if lastTime > Timer.Time then return end
+ lastTime = Timer.Time + 10
- lastTime = Timer.Time + 10
- print(config.Value)
-
- if SERVER then
- config.TrySetValue(config.Value + 1)
- end
+ if SERVER then
+ local succ = config.TrySetValue(config.Value + 1)
+ print("Success of setting value on server for '", config.InternalName,"': ", succ)
+ end
+ if CLIENT then
+ local succ = config.TrySetValue(config.Value + 1)
+ print("Success of setting value on client for '", config.InternalName,"': ", succ, " | This should fail if permissions are not set for client.")
+ end
+
end)
diff --git a/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/ModConfig.xml b/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/ModConfig.xml
index 1af981a06..b5f96babd 100644
--- a/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/ModConfig.xml
+++ b/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/ModConfig.xml
@@ -2,4 +2,6 @@
+
+
diff --git a/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml b/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml
index 6d37c0a87..5c7e4458f 100644
--- a/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml
+++ b/Barotrauma/BarotraumaShared/LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml
@@ -2,9 +2,9 @@
-
-
-
+
+
+