@quenty/settings 5.0.0-canary.331.7eefa75.0 → 5.0.0-canary.367.903617a.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 +113 -1
- package/LICENSE.md +1 -1
- package/package.json +23 -21
- package/src/Client/SettingsServiceClient.lua +23 -0
- package/src/Server/Cmdr/SettingsCmdrService.lua +69 -0
- package/src/Server/SettingsService.lua +8 -0
- package/src/Shared/Cmdr/SettingsCmdrUtils.lua +53 -0
- package/src/Shared/SettingRegistryServiceShared.lua +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,119 @@
|
|
|
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
|
-
# [5.0.0-canary.
|
|
6
|
+
# [5.0.0-canary.367.903617a.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.26.0...@quenty/settings@5.0.0-canary.367.903617a.0) (2023-06-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/settings
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [4.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.25.0...@quenty/settings@4.26.0) (2023-05-26)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* Fix dependencies ([67791a2](https://github.com/Quenty/NevermoreEngine/commit/67791a289c0956bf4947ac81bf792ee56496b3e8))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* Add cmdr support to settings ([43e1c25](https://github.com/Quenty/NevermoreEngine/commit/43e1c2550dd02ad95827bc93a20a5aa1ff5e5e4a))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [4.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.24.0...@quenty/settings@4.25.0) (2023-05-08)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @quenty/settings
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [4.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.23.0...@quenty/settings@4.24.0) (2023-04-20)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @quenty/settings
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# [4.23.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.22.1...@quenty/settings@4.23.0) (2023-04-10)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @quenty/settings
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [4.22.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.22.0...@quenty/settings@4.22.1) (2023-04-07)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @quenty/settings
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# [4.22.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.21.0...@quenty/settings@4.22.0) (2023-04-06)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @quenty/settings
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# [4.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.20.0...@quenty/settings@4.21.0) (2023-04-03)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @quenty/settings
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# [4.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.19.0...@quenty/settings@4.20.0) (2023-03-31)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @quenty/settings
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# [4.19.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.18.0...@quenty/settings@4.19.0) (2023-03-31)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @quenty/settings
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# [4.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.17.0...@quenty/settings@4.18.0) (2023-03-06)
|
|
95
|
+
|
|
96
|
+
**Note:** Version bump only for package @quenty/settings
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# [4.17.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.16.0...@quenty/settings@4.17.0) (2023-03-05)
|
|
103
|
+
|
|
104
|
+
**Note:** Version bump only for package @quenty/settings
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# [4.16.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.15.0...@quenty/settings@4.16.0) (2023-03-03)
|
|
111
|
+
|
|
112
|
+
**Note:** Version bump only for package @quenty/settings
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# [4.15.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/settings@4.14.0...@quenty/settings@4.15.0) (2023-02-27)
|
|
7
119
|
|
|
8
120
|
**Note:** Version bump only for package @quenty/settings
|
|
9
121
|
|
package/LICENSE.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/settings",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.367.903617a.0",
|
|
4
4
|
"description": "Centralized player settings service",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,31 +25,33 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/attributeutils": "
|
|
29
|
-
"@quenty/baseobject": "6.1
|
|
30
|
-
"@quenty/binder": "9.0.0-canary.
|
|
31
|
-
"@quenty/
|
|
32
|
-
"@quenty/
|
|
33
|
-
"@quenty/
|
|
34
|
-
"@quenty/
|
|
35
|
-
"@quenty/
|
|
36
|
-
"@quenty/
|
|
37
|
-
"@quenty/
|
|
38
|
-
"@quenty/
|
|
39
|
-
"@quenty/
|
|
40
|
-
"@quenty/
|
|
41
|
-
"@quenty/
|
|
42
|
-
"@quenty/
|
|
43
|
-
"@quenty/
|
|
44
|
-
"@quenty/
|
|
28
|
+
"@quenty/attributeutils": "8.15.0",
|
|
29
|
+
"@quenty/baseobject": "6.2.1",
|
|
30
|
+
"@quenty/binder": "9.0.0-canary.367.903617a.0",
|
|
31
|
+
"@quenty/cmdrservice": "7.15.0",
|
|
32
|
+
"@quenty/datastore": "8.0.0-canary.367.903617a.0",
|
|
33
|
+
"@quenty/enumutils": "3.1.0",
|
|
34
|
+
"@quenty/jsonutils": "6.5.0",
|
|
35
|
+
"@quenty/loader": "6.2.1",
|
|
36
|
+
"@quenty/maid": "2.5.0",
|
|
37
|
+
"@quenty/observablecollection": "6.0.0-canary.367.903617a.0",
|
|
38
|
+
"@quenty/playerbinder": "9.0.0-canary.367.903617a.0",
|
|
39
|
+
"@quenty/playerutils": "2.15.0",
|
|
40
|
+
"@quenty/remotefunctionutils": "6.6.0",
|
|
41
|
+
"@quenty/remoting": "6.5.0",
|
|
42
|
+
"@quenty/rx": "7.11.0",
|
|
43
|
+
"@quenty/rxbinderutils": "9.0.0-canary.367.903617a.0",
|
|
44
|
+
"@quenty/servicebag": "6.7.0",
|
|
45
|
+
"@quenty/signal": "2.4.0",
|
|
46
|
+
"@quenty/statestack": "9.0.0-canary.367.903617a.0",
|
|
45
47
|
"@quenty/string": "3.1.0",
|
|
46
48
|
"@quenty/symbol": "2.2.0",
|
|
47
49
|
"@quenty/table": "3.2.0",
|
|
48
|
-
"@quenty/throttle": "6.1
|
|
49
|
-
"@quenty/valueobject": "8.0.0-canary.
|
|
50
|
+
"@quenty/throttle": "6.2.1",
|
|
51
|
+
"@quenty/valueobject": "8.0.0-canary.367.903617a.0"
|
|
50
52
|
},
|
|
51
53
|
"publishConfig": {
|
|
52
54
|
"access": "public"
|
|
53
55
|
},
|
|
54
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "903617ace784bce6cc7e0a15093ee50566bd9b54"
|
|
55
57
|
}
|
|
@@ -12,6 +12,8 @@ local Players = game:GetService("Players")
|
|
|
12
12
|
|
|
13
13
|
local PlayerSettingsUtils = require("PlayerSettingsUtils")
|
|
14
14
|
local Rx = require("Rx")
|
|
15
|
+
local Maid = require("Maid")
|
|
16
|
+
local SettingsCmdrUtils = require("SettingsCmdrUtils")
|
|
15
17
|
|
|
16
18
|
local SettingsServiceClient = {}
|
|
17
19
|
|
|
@@ -23,12 +25,20 @@ local SettingsServiceClient = {}
|
|
|
23
25
|
function SettingsServiceClient:Init(serviceBag)
|
|
24
26
|
assert(not self._serviceBag, "Already initialized")
|
|
25
27
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
28
|
+
self._maid = Maid.new()
|
|
29
|
+
|
|
30
|
+
-- External
|
|
31
|
+
self._serviceBag:GetService(require("CmdrServiceClient"))
|
|
26
32
|
|
|
27
33
|
-- Internal
|
|
28
34
|
self._serviceBag:GetService(require("SettingRegistryServiceShared")):RegisterSettingService(self)
|
|
29
35
|
self._binders = self._serviceBag:GetService(require("SettingsBindersClient"))
|
|
30
36
|
end
|
|
31
37
|
|
|
38
|
+
function SettingsServiceClient:Start()
|
|
39
|
+
self:_setupCmdr()
|
|
40
|
+
end
|
|
41
|
+
|
|
32
42
|
--[=[
|
|
33
43
|
Gets the local player settings
|
|
34
44
|
@return PlayerSettingsClient | nil
|
|
@@ -118,4 +128,17 @@ function SettingsServiceClient:PromisePlayerSettings(player, cancelToken)
|
|
|
118
128
|
}), cancelToken)
|
|
119
129
|
end
|
|
120
130
|
|
|
131
|
+
|
|
132
|
+
function SettingsServiceClient:_setupCmdr()
|
|
133
|
+
local cmdrServiceClient = self._serviceBag:GetService(require("CmdrServiceClient"))
|
|
134
|
+
|
|
135
|
+
self._maid:GivePromise(cmdrServiceClient:PromiseCmdr()):Then(function(cmdr)
|
|
136
|
+
SettingsCmdrUtils.registerSettingDefinition(cmdr, self._serviceBag)
|
|
137
|
+
end)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
function SettingsServiceClient:Destroy()
|
|
141
|
+
self._maid:DoCleaning()
|
|
142
|
+
end
|
|
143
|
+
|
|
121
144
|
return SettingsServiceClient
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class SettingsCmdrService
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local PlayerUtils = require("PlayerUtils")
|
|
8
|
+
local SettingsCmdrUtils = require("SettingsCmdrUtils")
|
|
9
|
+
local Maid = require("Maid")
|
|
10
|
+
|
|
11
|
+
local SettingsCmdrService = {}
|
|
12
|
+
SettingsCmdrService.ServiceName = "SettingsCmdrService"
|
|
13
|
+
|
|
14
|
+
function SettingsCmdrService:Init(serviceBag)
|
|
15
|
+
assert(not self._serviceBag, "Already initialized")
|
|
16
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
17
|
+
self._maid = Maid.new()
|
|
18
|
+
|
|
19
|
+
self._cmdrService = self._serviceBag:GetService(require("CmdrService"))
|
|
20
|
+
self._settingService = self._serviceBag:GetService(require("SettingsService"))
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
function SettingsCmdrService:Start()
|
|
24
|
+
self:_setupCommands()
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
function SettingsCmdrService:_setupCommands()
|
|
28
|
+
self._maid:GivePromise(self._cmdrService:PromiseCmdr()):Then(function(cmdr)
|
|
29
|
+
SettingsCmdrUtils.registerSettingDefinition(cmdr, self._serviceBag)
|
|
30
|
+
end)
|
|
31
|
+
|
|
32
|
+
self._cmdrService:RegisterCommand({
|
|
33
|
+
Name = "restore-setting";
|
|
34
|
+
Aliases = { };
|
|
35
|
+
Description = "Restores the player setting to default.";
|
|
36
|
+
Group = "Settings";
|
|
37
|
+
Args = {
|
|
38
|
+
{
|
|
39
|
+
Name = "Players";
|
|
40
|
+
Type = "players";
|
|
41
|
+
Description = "Players to restore the default settings to.";
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
Name = "Settings";
|
|
45
|
+
Type = "settingDefinitions";
|
|
46
|
+
Description = "Settings to restore.";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}, function(_context, players, settingsDefinitions)
|
|
50
|
+
local givenTo = {}
|
|
51
|
+
|
|
52
|
+
for _, player in pairs(players) do
|
|
53
|
+
local playerSettings = self._settingService:PromisePlayerSettings(player):Wait()
|
|
54
|
+
for _, settingDefinition in pairs(settingsDefinitions) do
|
|
55
|
+
playerSettings:RestoreDefault(settingDefinition:GetSettingName(), settingDefinition:GetDefaultValue())
|
|
56
|
+
end
|
|
57
|
+
table.insert(givenTo, PlayerUtils.formatName(player))
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
return ("Reset settings for %s"):format(table.concat(givenTo, ", "))
|
|
61
|
+
end)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
function SettingsCmdrService:Destroy()
|
|
65
|
+
self._maid:DoCleaning()
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
return SettingsCmdrService
|
|
@@ -6,15 +6,19 @@ local require = require(script.Parent.loader).load(script)
|
|
|
6
6
|
|
|
7
7
|
local PlayerSettingsUtils = require("PlayerSettingsUtils")
|
|
8
8
|
local Rx = require("Rx")
|
|
9
|
+
local Maid = require("Maid")
|
|
9
10
|
|
|
10
11
|
local SettingsService = {}
|
|
11
12
|
|
|
12
13
|
function SettingsService:Init(serviceBag)
|
|
13
14
|
assert(not self._serviceBag, "Already initialized")
|
|
14
15
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
16
|
+
self._maid = Maid.new()
|
|
15
17
|
|
|
16
18
|
-- External
|
|
17
19
|
self._serviceBag:GetService(require("PlayerDataStoreService"))
|
|
20
|
+
self._serviceBag:GetService(require("SettingsCmdrService"))
|
|
21
|
+
|
|
18
22
|
|
|
19
23
|
-- Internal
|
|
20
24
|
self._binders = self._serviceBag:GetService(require("SettingsBindersServer"))
|
|
@@ -49,4 +53,8 @@ function SettingsService:PromisePlayerSettings(player, cancelToken)
|
|
|
49
53
|
}), cancelToken)
|
|
50
54
|
end
|
|
51
55
|
|
|
56
|
+
function SettingsService:Destroy()
|
|
57
|
+
self._maid:DoCleaning()
|
|
58
|
+
end
|
|
59
|
+
|
|
52
60
|
return SettingsService
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class SettingsCmdrUtils
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local ServiceBag = require("ServiceBag")
|
|
8
|
+
local SettingRegistryServiceShared = require("SettingRegistryServiceShared")
|
|
9
|
+
|
|
10
|
+
local SettingsCmdrUtils = {}
|
|
11
|
+
|
|
12
|
+
function SettingsCmdrUtils.registerSettingDefinition(cmdr, serviceBag)
|
|
13
|
+
assert(ServiceBag.isServiceBag(serviceBag), "Bad serviceBag")
|
|
14
|
+
|
|
15
|
+
local settingRegistryService = serviceBag:GetService(SettingRegistryServiceShared)
|
|
16
|
+
|
|
17
|
+
local settingDefinitionType = {
|
|
18
|
+
Transform = function(text)
|
|
19
|
+
local definitions = settingRegistryService:GetSettingDefinitions()
|
|
20
|
+
local settingNames = {}
|
|
21
|
+
for _, settingDefinition in pairs(definitions) do
|
|
22
|
+
table.insert(settingNames, settingDefinition:GetSettingName())
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
local find = cmdr.Util.MakeFuzzyFinder(settingNames)
|
|
26
|
+
return find(text)
|
|
27
|
+
end;
|
|
28
|
+
Validate = function(keys)
|
|
29
|
+
return #keys > 0, "No item model with that name could be found."
|
|
30
|
+
end,
|
|
31
|
+
Autocomplete = function(keys)
|
|
32
|
+
return keys
|
|
33
|
+
end,
|
|
34
|
+
Parse = function(keys)
|
|
35
|
+
local name = keys[1]
|
|
36
|
+
|
|
37
|
+
local definitions = settingRegistryService:GetSettingDefinitions()
|
|
38
|
+
for _, settingDefinition in pairs(definitions) do
|
|
39
|
+
if settingDefinition:GetSettingName() == name then
|
|
40
|
+
return settingDefinition
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
return nil
|
|
45
|
+
end;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
cmdr.Registry:RegisterType("settingDefinition", settingDefinitionType)
|
|
49
|
+
cmdr.Registry:RegisterType("settingDefinitions", cmdr.Util.MakeListableType(settingDefinitionType))
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
return SettingsCmdrUtils
|
|
@@ -30,6 +30,10 @@ function SettingRegistryServiceShared:Init(serviceBag)
|
|
|
30
30
|
self._maid:GiveTask(self._settingDefinitions)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
function SettingRegistryServiceShared:GetSettingDefinitions()
|
|
34
|
+
return self._settingDefinitions:GetList()
|
|
35
|
+
end
|
|
36
|
+
|
|
33
37
|
--[=[
|
|
34
38
|
Registers the shared setting service for this bridge
|
|
35
39
|
|