@quenty/settings 11.24.0-canary.ae8d76d.0 → 11.24.1-canary.d9ea7a3.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 +9 -1
- 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 +20 -18
- package/src/Shared/Cmdr/SettingsCmdrUtils.lua +12 -13
- 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 +6 -5
- package/src/Shared/Setting/SettingProperty.lua +1 -1
- package/test/scripts/Client/ClientMain.client.lua +1 -1
- package/test/scripts/Server/ServerMain.server.lua +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
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.1-canary.d9ea7a3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@11.24.0...@quenty/settings@11.24.1-canary.d9ea7a3.0) (2025-05-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/settings
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [11.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@11.23.3...@quenty/settings@11.24.0) (2025-05-10)
|
|
7
15
|
|
|
8
16
|
|
|
9
17
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/settings",
|
|
3
|
-
"version": "11.24.
|
|
3
|
+
"version": "11.24.1-canary.d9ea7a3.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.18.0
|
|
29
|
-
"@quenty/baseobject": "10.
|
|
30
|
-
"@quenty/binder": "14.20.
|
|
31
|
-
"@quenty/brio": "14.18.0
|
|
32
|
-
"@quenty/cmdrservice": "13.23.
|
|
33
|
-
"@quenty/datastore": "13.21.
|
|
34
|
-
"@quenty/ducktype": "5.
|
|
28
|
+
"@quenty/attributeutils": "14.18.0",
|
|
29
|
+
"@quenty/baseobject": "10.9.0",
|
|
30
|
+
"@quenty/binder": "14.20.1-canary.d9ea7a3.0",
|
|
31
|
+
"@quenty/brio": "14.18.0",
|
|
32
|
+
"@quenty/cmdrservice": "13.23.1-canary.d9ea7a3.0",
|
|
33
|
+
"@quenty/datastore": "13.21.1-canary.d9ea7a3.0",
|
|
34
|
+
"@quenty/ducktype": "5.9.0",
|
|
35
35
|
"@quenty/enumutils": "3.4.2",
|
|
36
|
-
"@quenty/instanceutils": "13.18.0
|
|
37
|
-
"@quenty/jsonutils": "10.11.0
|
|
38
|
-
"@quenty/loader": "10.
|
|
39
|
-
"@quenty/maid": "3.
|
|
40
|
-
"@quenty/observablecollection": "12.21.0
|
|
41
|
-
"@quenty/playerbinder": "14.20.
|
|
42
|
-
"@quenty/playerutils": "8.18.0
|
|
43
|
-
"@quenty/remotefunctionutils": "10.11.0
|
|
44
|
-
"@quenty/remoting": "12.19.0
|
|
45
|
-
"@quenty/rx": "13.18.0
|
|
46
|
-
"@quenty/rxbinderutils": "14.20.
|
|
47
|
-
"@quenty/rxsignal": "7.18.0
|
|
48
|
-
"@quenty/servicebag": "11.12.
|
|
49
|
-
"@quenty/signal": "7.
|
|
50
|
-
"@quenty/statestack": "14.19.0
|
|
36
|
+
"@quenty/instanceutils": "13.18.0",
|
|
37
|
+
"@quenty/jsonutils": "10.11.0",
|
|
38
|
+
"@quenty/loader": "10.9.0",
|
|
39
|
+
"@quenty/maid": "3.5.0",
|
|
40
|
+
"@quenty/observablecollection": "12.21.0",
|
|
41
|
+
"@quenty/playerbinder": "14.20.1-canary.d9ea7a3.0",
|
|
42
|
+
"@quenty/playerutils": "8.18.0",
|
|
43
|
+
"@quenty/remotefunctionutils": "10.11.0",
|
|
44
|
+
"@quenty/remoting": "12.19.0",
|
|
45
|
+
"@quenty/rx": "13.18.0",
|
|
46
|
+
"@quenty/rxbinderutils": "14.20.1-canary.d9ea7a3.0",
|
|
47
|
+
"@quenty/rxsignal": "7.18.0",
|
|
48
|
+
"@quenty/servicebag": "11.12.1-canary.d9ea7a3.0",
|
|
49
|
+
"@quenty/signal": "7.11.0",
|
|
50
|
+
"@quenty/statestack": "14.19.0",
|
|
51
51
|
"@quenty/string": "3.3.3",
|
|
52
|
-
"@quenty/symbol": "3.
|
|
53
|
-
"@quenty/table": "3.
|
|
54
|
-
"@quenty/throttle": "10.
|
|
55
|
-
"@quenty/tie": "10.21.0
|
|
56
|
-
"@quenty/valueobject": "13.18.0
|
|
52
|
+
"@quenty/symbol": "3.5.0",
|
|
53
|
+
"@quenty/table": "3.8.0",
|
|
54
|
+
"@quenty/throttle": "10.10.0",
|
|
55
|
+
"@quenty/tie": "10.21.0",
|
|
56
|
+
"@quenty/valueobject": "13.18.0"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "d9ea7a314a7d50712e6abac75d29901c1edea556"
|
|
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")
|
|
22
23
|
local Remoting = require("Remoting")
|
|
24
|
+
local ServiceBag = require("ServiceBag")
|
|
23
25
|
local Symbol = require("Symbol")
|
|
24
26
|
local ThrottledFunction = require("ThrottledFunction")
|
|
25
27
|
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 PlayerUtils = require("PlayerUtils")
|
|
10
|
-
local SettingsCmdrUtils = require("SettingsCmdrUtils")
|
|
11
9
|
local Maid = require("Maid")
|
|
10
|
+
local PlayerUtils = require("PlayerUtils")
|
|
12
11
|
local ServiceBag = require("ServiceBag")
|
|
12
|
+
local SettingsCmdrUtils = require("SettingsCmdrUtils")
|
|
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 PlayerSettingsUtils = require("PlayerSettingsUtils")
|
|
9
|
-
local PlayerSettings = require("PlayerSettings")
|
|
10
|
-
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
11
8
|
local DataStoreStringUtils = require("DataStoreStringUtils")
|
|
12
|
-
local PlayerSettingsConstants = require("PlayerSettingsConstants")
|
|
13
9
|
local PlayerBinder = require("PlayerBinder")
|
|
10
|
+
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
11
|
+
local PlayerSettings = require("PlayerSettings")
|
|
12
|
+
local PlayerSettingsConstants = require("PlayerSettingsConstants")
|
|
13
|
+
local PlayerSettingsUtils = require("PlayerSettingsUtils")
|
|
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
|
|
44
|
+
self._maid
|
|
45
|
+
:GivePromise(self._playerDataStoreService:PromiseDataStore(self._obj))
|
|
45
46
|
:Then(function(dataStore)
|
|
46
47
|
-- Ensure we've fully loaded before we parent.
|
|
47
48
|
-- This should ensure the cache is mostly instant.
|
|
48
49
|
|
|
49
50
|
local subStore = dataStore:GetSubStore("settings")
|
|
50
51
|
|
|
51
|
-
return dataStore:Load("settings", {})
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
self
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
end)
|
|
52
|
+
return dataStore:Load("settings", {}):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,7 +85,9 @@ 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(
|
|
88
|
+
warn(
|
|
89
|
+
string.format("[PlayerSettingsClient.SetValue] - Setting is too long for %q. Cannot save.", settingName)
|
|
90
|
+
)
|
|
89
91
|
return
|
|
90
92
|
end
|
|
91
93
|
-- TODO: JSON encode and check length for ther scenarios
|
|
@@ -94,4 +96,4 @@ function PlayerHasSettings:_handleAttributeChanged(subStore, attributeName)
|
|
|
94
96
|
subStore:Store(settingName, newValue)
|
|
95
97
|
end
|
|
96
98
|
|
|
97
|
-
return PlayerBinder.new("PlayerHasSettings", PlayerHasSettings)
|
|
99
|
+
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,12 +42,11 @@ 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
|
-
|
|
53
|
-
return SettingsCmdrUtils
|
|
52
|
+
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")
|
|
11
12
|
local PlayerSettingsUtils = require("PlayerSettingsUtils")
|
|
12
|
-
local RxAttributeUtils = require("RxAttributeUtils")
|
|
13
|
-
local SettingDefinition = require("SettingDefinition")
|
|
14
13
|
local Rx = require("Rx")
|
|
15
|
-
local
|
|
14
|
+
local RxAttributeUtils = require("RxAttributeUtils")
|
|
16
15
|
local ServiceBag = require("ServiceBag")
|
|
16
|
+
local SettingDefinition = require("SettingDefinition")
|
|
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")
|
|
10
12
|
local PlayerSettingsConstants = require("PlayerSettingsConstants")
|
|
11
13
|
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 SettingDefinition = require("SettingDefinition")
|
|
31
30
|
local ServiceBag = require("ServiceBag")
|
|
31
|
+
local SettingDefinition = require("SettingDefinition")
|
|
32
32
|
|
|
33
33
|
local SettingDefinitionProvider = {}
|
|
34
34
|
SettingDefinitionProvider.ClassName = "SettingDefinitionProvider"
|
|
@@ -176,12 +176,13 @@ 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
|
|
179
|
+
elseif
|
|
180
|
+
index == "_lookup"
|
|
180
181
|
or index == "_settingDefinitionList"
|
|
181
182
|
or index == "_maid"
|
|
182
183
|
or index == "_initializedDefinitionLookup"
|
|
183
|
-
or index == "_serviceBag"
|
|
184
|
-
|
|
184
|
+
or index == "_serviceBag"
|
|
185
|
+
then
|
|
185
186
|
return rawget(self, index)
|
|
186
187
|
elseif type(index) == "string" then
|
|
187
188
|
local lookup = rawget(self, "_lookup")
|
|
@@ -228,4 +229,4 @@ function SettingDefinitionProvider:Destroy()
|
|
|
228
229
|
self._maid:DoCleaning()
|
|
229
230
|
end
|
|
230
231
|
|
|
231
|
-
return SettingDefinitionProvider
|
|
232
|
+
return SettingDefinitionProvider
|
|
@@ -17,7 +17,6 @@ serviceBag:GetService(screenShakeDefinition)
|
|
|
17
17
|
serviceBag:Init()
|
|
18
18
|
serviceBag:Start()
|
|
19
19
|
|
|
20
|
-
|
|
21
20
|
local volumeDefinition = SettingDefinition.new("Volume", 1)
|
|
22
21
|
bridge:RegisterSettingDefinition(volumeDefinition)
|
|
23
22
|
|
|
@@ -41,4 +40,3 @@ game.Players.PlayerAdded:Connect(handlePlayer)
|
|
|
41
40
|
for _, player in game.Players:GetPlayers() do
|
|
42
41
|
handlePlayer(player)
|
|
43
42
|
end
|
|
44
|
-
|