@quenty/settings 11.23.4-canary.559.9f38947.0 → 11.24.0-canary.0a5db80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -10
- package/package.json +29 -29
- package/src/Client/Player/PlayerSettingsClient.lua +2 -2
- package/src/Server/Cmdr/SettingsCmdrService.lua +2 -2
- package/src/Server/Player/PlayerHasSettings.lua +18 -20
- package/src/Shared/Cmdr/SettingsCmdrUtils.lua +13 -12
- package/src/Shared/Interface/PlayerSettingsInterface.lua +8 -8
- package/src/Shared/Player/PlayerSettingsBase.lua +4 -4
- package/src/Shared/Player/PlayerSettingsConstants.lua +8 -8
- package/src/Shared/Player/PlayerSettingsUtils.lua +2 -2
- package/src/Shared/Setting/SettingDefinition.lua +1 -1
- package/src/Shared/Setting/SettingDefinitionProvider.lua +5 -6
- package/src/Shared/Setting/SettingProperty.lua +1 -1
- package/test/scripts/Client/ClientMain.client.lua +1 -1
- package/test/scripts/Server/ServerMain.server.lua +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,20 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [11.24.0-canary.0a5db80.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@11.23.2...@quenty/settings@11.24.0-canary.0a5db80.0) (2025-05-10)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
* Additional type checking updates ([
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## [11.23.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@11.23.2...@quenty/settings@11.23.3) (2025-04-10)
|
|
18
|
-
|
|
19
|
-
**Note:** Version bump only for package @quenty/settings
|
|
11
|
+
* Additional type checking updates ([7e008c5](https://github.com/Quenty/NevermoreEngine/commit/7e008c58547bd00b5904e56541454a38c8d72ccc))
|
|
20
12
|
|
|
21
13
|
|
|
22
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/settings",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.24.0-canary.0a5db80.0",
|
|
4
4
|
"description": "Centralized player settings service",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,38 +25,38 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/attributeutils": "14.
|
|
29
|
-
"@quenty/baseobject": "10.
|
|
30
|
-
"@quenty/binder": "14.
|
|
31
|
-
"@quenty/brio": "14.
|
|
32
|
-
"@quenty/cmdrservice": "13.
|
|
33
|
-
"@quenty/datastore": "13.
|
|
34
|
-
"@quenty/ducktype": "5.
|
|
28
|
+
"@quenty/attributeutils": "14.18.0-canary.0a5db80.0",
|
|
29
|
+
"@quenty/baseobject": "10.9.0-canary.0a5db80.0",
|
|
30
|
+
"@quenty/binder": "14.20.0-canary.0a5db80.0",
|
|
31
|
+
"@quenty/brio": "14.18.0-canary.0a5db80.0",
|
|
32
|
+
"@quenty/cmdrservice": "13.23.0-canary.0a5db80.0",
|
|
33
|
+
"@quenty/datastore": "13.21.0-canary.0a5db80.0",
|
|
34
|
+
"@quenty/ducktype": "5.9.0-canary.0a5db80.0",
|
|
35
35
|
"@quenty/enumutils": "3.4.2",
|
|
36
|
-
"@quenty/instanceutils": "13.
|
|
37
|
-
"@quenty/jsonutils": "10.
|
|
38
|
-
"@quenty/loader": "10.
|
|
39
|
-
"@quenty/maid": "3.
|
|
40
|
-
"@quenty/observablecollection": "12.
|
|
41
|
-
"@quenty/playerbinder": "14.
|
|
42
|
-
"@quenty/playerutils": "8.
|
|
43
|
-
"@quenty/remotefunctionutils": "10.
|
|
44
|
-
"@quenty/remoting": "12.
|
|
45
|
-
"@quenty/rx": "13.
|
|
46
|
-
"@quenty/rxbinderutils": "14.
|
|
47
|
-
"@quenty/rxsignal": "7.
|
|
48
|
-
"@quenty/servicebag": "11.
|
|
49
|
-
"@quenty/signal": "7.
|
|
50
|
-
"@quenty/statestack": "14.
|
|
36
|
+
"@quenty/instanceutils": "13.18.0-canary.0a5db80.0",
|
|
37
|
+
"@quenty/jsonutils": "10.11.0-canary.0a5db80.0",
|
|
38
|
+
"@quenty/loader": "10.9.0-canary.0a5db80.0",
|
|
39
|
+
"@quenty/maid": "3.5.0-canary.0a5db80.0",
|
|
40
|
+
"@quenty/observablecollection": "12.21.0-canary.0a5db80.0",
|
|
41
|
+
"@quenty/playerbinder": "14.20.0-canary.0a5db80.0",
|
|
42
|
+
"@quenty/playerutils": "8.18.0-canary.0a5db80.0",
|
|
43
|
+
"@quenty/remotefunctionutils": "10.11.0-canary.0a5db80.0",
|
|
44
|
+
"@quenty/remoting": "12.19.0-canary.0a5db80.0",
|
|
45
|
+
"@quenty/rx": "13.18.0-canary.0a5db80.0",
|
|
46
|
+
"@quenty/rxbinderutils": "14.20.0-canary.0a5db80.0",
|
|
47
|
+
"@quenty/rxsignal": "7.18.0-canary.0a5db80.0",
|
|
48
|
+
"@quenty/servicebag": "11.12.0-canary.0a5db80.0",
|
|
49
|
+
"@quenty/signal": "7.11.0-canary.0a5db80.0",
|
|
50
|
+
"@quenty/statestack": "14.19.0-canary.0a5db80.0",
|
|
51
51
|
"@quenty/string": "3.3.3",
|
|
52
|
-
"@quenty/symbol": "3.4.
|
|
53
|
-
"@quenty/table": "3.
|
|
54
|
-
"@quenty/throttle": "10.
|
|
55
|
-
"@quenty/tie": "10.
|
|
56
|
-
"@quenty/valueobject": "13.
|
|
52
|
+
"@quenty/symbol": "3.4.2",
|
|
53
|
+
"@quenty/table": "3.8.0-canary.0a5db80.0",
|
|
54
|
+
"@quenty/throttle": "10.10.0-canary.0a5db80.0",
|
|
55
|
+
"@quenty/tie": "10.21.0-canary.0a5db80.0",
|
|
56
|
+
"@quenty/valueobject": "13.18.0-canary.0a5db80.0"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "0a5db8004684dc3e76fd5944599a22602d48cfa9"
|
|
62
62
|
}
|
|
@@ -19,12 +19,12 @@ local PlayerSettingsBase = require("PlayerSettingsBase")
|
|
|
19
19
|
local PlayerSettingsConstants = require("PlayerSettingsConstants")
|
|
20
20
|
local PlayerSettingsInterface = require("PlayerSettingsInterface")
|
|
21
21
|
local PlayerSettingsUtils = require("PlayerSettingsUtils")
|
|
22
|
-
local Promise = require("Promise")
|
|
23
22
|
local Remoting = require("Remoting")
|
|
24
|
-
local ServiceBag = require("ServiceBag")
|
|
25
23
|
local Symbol = require("Symbol")
|
|
26
24
|
local ThrottledFunction = require("ThrottledFunction")
|
|
27
25
|
local ValueObject = require("ValueObject")
|
|
26
|
+
local ServiceBag = require("ServiceBag")
|
|
27
|
+
local Promise = require("Promise")
|
|
28
28
|
|
|
29
29
|
local UNSET_VALUE = Symbol.named("unsetValue")
|
|
30
30
|
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
-
local Maid = require("Maid")
|
|
10
9
|
local PlayerUtils = require("PlayerUtils")
|
|
11
|
-
local ServiceBag = require("ServiceBag")
|
|
12
10
|
local SettingsCmdrUtils = require("SettingsCmdrUtils")
|
|
11
|
+
local Maid = require("Maid")
|
|
12
|
+
local ServiceBag = require("ServiceBag")
|
|
13
13
|
|
|
14
14
|
local SettingsCmdrService = {}
|
|
15
15
|
SettingsCmdrService.ServiceName = "SettingsCmdrService"
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
7
|
local BaseObject = require("BaseObject")
|
|
8
|
-
local
|
|
9
|
-
local PlayerBinder = require("PlayerBinder")
|
|
10
|
-
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
8
|
+
local PlayerSettingsUtils = require("PlayerSettingsUtils")
|
|
11
9
|
local PlayerSettings = require("PlayerSettings")
|
|
10
|
+
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
11
|
+
local DataStoreStringUtils = require("DataStoreStringUtils")
|
|
12
12
|
local PlayerSettingsConstants = require("PlayerSettingsConstants")
|
|
13
|
-
local
|
|
13
|
+
local PlayerBinder = require("PlayerBinder")
|
|
14
14
|
local ServiceBag = require("ServiceBag")
|
|
15
15
|
|
|
16
16
|
local PlayerHasSettings = setmetatable({}, BaseObject)
|
|
@@ -41,24 +41,24 @@ end
|
|
|
41
41
|
function PlayerHasSettings:_promiseLoadSettings()
|
|
42
42
|
self._settings = self._maid:Add(PlayerSettingsUtils.create())
|
|
43
43
|
|
|
44
|
-
self._maid
|
|
45
|
-
:GivePromise(self._playerDataStoreService:PromiseDataStore(self._obj))
|
|
44
|
+
self._maid:GivePromise(self._playerDataStoreService:PromiseDataStore(self._obj))
|
|
46
45
|
:Then(function(dataStore)
|
|
47
46
|
-- Ensure we've fully loaded before we parent.
|
|
48
47
|
-- This should ensure the cache is mostly instant.
|
|
49
48
|
|
|
50
49
|
local subStore = dataStore:GetSubStore("settings")
|
|
51
50
|
|
|
52
|
-
return dataStore:Load("settings", {})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
self:
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
return dataStore:Load("settings", {})
|
|
52
|
+
:Then(function(settings)
|
|
53
|
+
for settingName, value in settings do
|
|
54
|
+
local attributeName = PlayerSettingsUtils.getAttributeName(settingName)
|
|
55
|
+
self._settings:SetAttribute(attributeName, PlayerSettingsUtils.encodeForAttribute(value))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
self._maid:GiveTask(self._settings.AttributeChanged:Connect(function(attributeName)
|
|
59
|
+
self:_handleAttributeChanged(subStore, attributeName)
|
|
60
|
+
end))
|
|
61
|
+
end)
|
|
62
62
|
end)
|
|
63
63
|
:Catch(function(err)
|
|
64
64
|
warn(string.format("[PlayerHasSettings] - Failed to load settings for player. %s", tostring(err)))
|
|
@@ -85,9 +85,7 @@ function PlayerHasSettings:_handleAttributeChanged(subStore, attributeName)
|
|
|
85
85
|
|
|
86
86
|
if type(newValue) == "string" then
|
|
87
87
|
if (#settingName + #newValue) > PlayerSettingsConstants.MAX_SETTINGS_LENGTH then
|
|
88
|
-
warn(
|
|
89
|
-
string.format("[PlayerSettingsClient.SetValue] - Setting is too long for %q. Cannot save.", settingName)
|
|
90
|
-
)
|
|
88
|
+
warn(string.format("[PlayerSettingsClient.SetValue] - Setting is too long for %q. Cannot save.", settingName))
|
|
91
89
|
return
|
|
92
90
|
end
|
|
93
91
|
-- TODO: JSON encode and check length for ther scenarios
|
|
@@ -96,4 +94,4 @@ function PlayerHasSettings:_handleAttributeChanged(subStore, attributeName)
|
|
|
96
94
|
subStore:Store(settingName, newValue)
|
|
97
95
|
end
|
|
98
96
|
|
|
99
|
-
return PlayerBinder.new("PlayerHasSettings", PlayerHasSettings)
|
|
97
|
+
return PlayerBinder.new("PlayerHasSettings", PlayerHasSettings)
|
|
@@ -18,23 +18,23 @@ function SettingsCmdrUtils.registerSettingDefinition(cmdr, serviceBag)
|
|
|
18
18
|
Transform = function(text)
|
|
19
19
|
local definitions = settingsDataService:GetSettingDefinitions()
|
|
20
20
|
local settingNames = {}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
for _, settingDefinition in definitions do
|
|
22
|
+
table.insert(settingNames, settingDefinition:GetSettingName())
|
|
23
|
+
end
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
end
|
|
25
|
+
local find = cmdr.Util.MakeFuzzyFinder(settingNames)
|
|
26
|
+
return find(text)
|
|
27
|
+
end;
|
|
28
28
|
Validate = function(keys)
|
|
29
|
-
|
|
29
|
+
return #keys > 0, "No item model with that name could be found."
|
|
30
30
|
end,
|
|
31
31
|
Autocomplete = function(keys)
|
|
32
|
-
|
|
32
|
+
return keys
|
|
33
33
|
end,
|
|
34
34
|
Parse = function(keys)
|
|
35
|
-
|
|
35
|
+
local name = keys[1]
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
local definitions = settingsDataService:GetSettingDefinitions()
|
|
38
38
|
for _, settingDefinition in definitions do
|
|
39
39
|
if settingDefinition:GetSettingName() == name then
|
|
40
40
|
return settingDefinition
|
|
@@ -42,11 +42,12 @@ function SettingsCmdrUtils.registerSettingDefinition(cmdr, serviceBag)
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
return nil
|
|
45
|
-
end
|
|
45
|
+
end;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
cmdr.Registry:RegisterType("settingDefinition", settingDefinitionType)
|
|
49
49
|
cmdr.Registry:RegisterType("settingDefinitions", cmdr.Util.MakeListableType(settingDefinitionType))
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
|
|
53
|
+
return SettingsCmdrUtils
|
|
@@ -7,11 +7,11 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
7
|
local TieDefinition = require("TieDefinition")
|
|
8
8
|
|
|
9
9
|
return TieDefinition.new("PlayerSettings", {
|
|
10
|
-
GetSettingProperty = TieDefinition.Types.METHOD
|
|
11
|
-
GetValue = TieDefinition.Types.METHOD
|
|
12
|
-
SetValue = TieDefinition.Types.METHOD
|
|
13
|
-
ObserveValue = TieDefinition.Types.METHOD
|
|
14
|
-
RestoreDefault = TieDefinition.Types.METHOD
|
|
15
|
-
EnsureInitialized = TieDefinition.Types.METHOD
|
|
16
|
-
GetPlayer = TieDefinition.Types.METHOD
|
|
17
|
-
})
|
|
10
|
+
GetSettingProperty = TieDefinition.Types.METHOD;
|
|
11
|
+
GetValue = TieDefinition.Types.METHOD;
|
|
12
|
+
SetValue = TieDefinition.Types.METHOD;
|
|
13
|
+
ObserveValue = TieDefinition.Types.METHOD;
|
|
14
|
+
RestoreDefault = TieDefinition.Types.METHOD;
|
|
15
|
+
EnsureInitialized = TieDefinition.Types.METHOD;
|
|
16
|
+
GetPlayer = TieDefinition.Types.METHOD;
|
|
17
|
+
})
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
local require = require(script.Parent.loader).load(script)
|
|
9
9
|
|
|
10
10
|
local BaseObject = require("BaseObject")
|
|
11
|
-
local DataStoreStringUtils = require("DataStoreStringUtils")
|
|
12
11
|
local PlayerSettingsUtils = require("PlayerSettingsUtils")
|
|
13
|
-
local Rx = require("Rx")
|
|
14
12
|
local RxAttributeUtils = require("RxAttributeUtils")
|
|
15
|
-
local ServiceBag = require("ServiceBag")
|
|
16
13
|
local SettingDefinition = require("SettingDefinition")
|
|
14
|
+
local Rx = require("Rx")
|
|
15
|
+
local DataStoreStringUtils = require("DataStoreStringUtils")
|
|
16
|
+
local ServiceBag = require("ServiceBag")
|
|
17
17
|
|
|
18
18
|
local PlayerSettingsBase = setmetatable({}, BaseObject)
|
|
19
19
|
PlayerSettingsBase.ClassName = "PlayerSettingsBase"
|
|
@@ -164,4 +164,4 @@ function PlayerSettingsBase.EnsureInitialized(_self: PlayerSettingsBase, setting
|
|
|
164
164
|
-- noop
|
|
165
165
|
end
|
|
166
166
|
|
|
167
|
-
return PlayerSettingsBase
|
|
167
|
+
return PlayerSettingsBase
|
|
@@ -8,12 +8,12 @@ local require = require(script.Parent.loader).load(script)
|
|
|
8
8
|
local Table = require("Table")
|
|
9
9
|
|
|
10
10
|
return Table.readonly({
|
|
11
|
-
SETTING_ATTRIBUTE_PREFIX = "Setting_"
|
|
12
|
-
SETTING_DEFAULT_VALUE_SUFFIX = "_Default"
|
|
13
|
-
SETTING_LOCAL_USER_VALUE_SUFFIX = "_Client"
|
|
11
|
+
SETTING_ATTRIBUTE_PREFIX = "Setting_";
|
|
12
|
+
SETTING_DEFAULT_VALUE_SUFFIX = "_Default";
|
|
13
|
+
SETTING_LOCAL_USER_VALUE_SUFFIX = "_Client";
|
|
14
14
|
|
|
15
|
-
PLAYER_SETTINGS_NAME = "PlayerSettings"
|
|
16
|
-
REMOTE_FUNCTION_NAME = "PlayerSettingsRemoteFunction"
|
|
17
|
-
REQUEST_UPDATE_SETTINGS = "requestUpdateSettings"
|
|
18
|
-
MAX_SETTINGS_LENGTH = 2048
|
|
19
|
-
})
|
|
15
|
+
PLAYER_SETTINGS_NAME = "PlayerSettings";
|
|
16
|
+
REMOTE_FUNCTION_NAME = "PlayerSettingsRemoteFunction";
|
|
17
|
+
REQUEST_UPDATE_SETTINGS = "requestUpdateSettings";
|
|
18
|
+
MAX_SETTINGS_LENGTH = 2048;
|
|
19
|
+
})
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
local require = require(script.Parent.loader).load(script)
|
|
9
9
|
|
|
10
|
-
local DataStoreStringUtils = require("DataStoreStringUtils")
|
|
11
|
-
local EnumUtils = require("EnumUtils")
|
|
12
10
|
local PlayerSettingsConstants = require("PlayerSettingsConstants")
|
|
13
11
|
local String = require("String")
|
|
12
|
+
local EnumUtils = require("EnumUtils")
|
|
13
|
+
local DataStoreStringUtils = require("DataStoreStringUtils")
|
|
14
14
|
|
|
15
15
|
local PlayerSettingsUtils = {}
|
|
16
16
|
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
local require = require(script.Parent.loader).load(script)
|
|
28
28
|
|
|
29
29
|
local Maid = require("Maid")
|
|
30
|
-
local ServiceBag = require("ServiceBag")
|
|
31
30
|
local SettingDefinition = require("SettingDefinition")
|
|
31
|
+
local ServiceBag = require("ServiceBag")
|
|
32
32
|
|
|
33
33
|
local SettingDefinitionProvider = {}
|
|
34
34
|
SettingDefinitionProvider.ClassName = "SettingDefinitionProvider"
|
|
@@ -176,13 +176,12 @@ function SettingDefinitionProvider:__index(index)
|
|
|
176
176
|
error("[SettingDefinitionProvider] - Cannot index provider with nil value")
|
|
177
177
|
elseif SettingDefinitionProvider[index] then
|
|
178
178
|
return SettingDefinitionProvider[index]
|
|
179
|
-
elseif
|
|
180
|
-
index == "_lookup"
|
|
179
|
+
elseif index == "_lookup"
|
|
181
180
|
or index == "_settingDefinitionList"
|
|
182
181
|
or index == "_maid"
|
|
183
182
|
or index == "_initializedDefinitionLookup"
|
|
184
|
-
or index == "_serviceBag"
|
|
185
|
-
|
|
183
|
+
or index == "_serviceBag" then
|
|
184
|
+
|
|
186
185
|
return rawget(self, index)
|
|
187
186
|
elseif type(index) == "string" then
|
|
188
187
|
local lookup = rawget(self, "_lookup")
|
|
@@ -229,4 +228,4 @@ function SettingDefinitionProvider:Destroy()
|
|
|
229
228
|
self._maid:DoCleaning()
|
|
230
229
|
end
|
|
231
230
|
|
|
232
|
-
return SettingDefinitionProvider
|
|
231
|
+
return SettingDefinitionProvider
|
|
@@ -17,6 +17,7 @@ serviceBag:GetService(screenShakeDefinition)
|
|
|
17
17
|
serviceBag:Init()
|
|
18
18
|
serviceBag:Start()
|
|
19
19
|
|
|
20
|
+
|
|
20
21
|
local volumeDefinition = SettingDefinition.new("Volume", 1)
|
|
21
22
|
bridge:RegisterSettingDefinition(volumeDefinition)
|
|
22
23
|
|
|
@@ -40,3 +41,4 @@ game.Players.PlayerAdded:Connect(handlePlayer)
|
|
|
40
41
|
for _, player in game.Players:GetPlayers() do
|
|
41
42
|
handlePlayer(player)
|
|
42
43
|
end
|
|
44
|
+
|