@quenty/scoredactionservice 6.2.1-canary.256.edbbcfc.0 → 7.0.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 +12 -1
- package/LICENSE.md +1 -1
- package/package.json +13 -13
- package/src/Client/InputList/InputListScoreHelper.lua +16 -15
- package/src/Client/Picker/ScoredActionPicker.lua +2 -0
- package/src/Client/Picker/ScoredActionPickerProvider.lua +3 -3
- package/src/Client/ScoredActionService.lua +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,18 @@
|
|
|
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
|
+
# [7.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/scoredactionservice@6.3.0...@quenty/scoredactionservice@7.0.0) (2022-05-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Upgrade ScoredActionService to handle input keybindings changing ([e2a38e4](https://github.com/Quenty/NevermoreEngine/commit/e2a38e4d4103e1f39c4bfa28c77848c9b08a6723))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [6.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/scoredactionservice@6.2.0...@quenty/scoredactionservice@6.3.0) (2022-03-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/scoredactionservice
|
|
9
20
|
|
package/LICENSE.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/scoredactionservice",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Scores actions and picks the highest rated one every frame",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/baseobject": "
|
|
30
|
-
"@quenty/brio": "
|
|
31
|
-
"@quenty/inputkeymaputils": "
|
|
32
|
-
"@quenty/inputmode": "
|
|
33
|
-
"@quenty/loader": "
|
|
34
|
-
"@quenty/maid": "2.
|
|
35
|
-
"@quenty/rx": "
|
|
36
|
-
"@quenty/signal": "2.
|
|
37
|
-
"@quenty/statestack": "
|
|
38
|
-
"@quenty/table": "
|
|
39
|
-
"@quenty/valueobject": "
|
|
29
|
+
"@quenty/baseobject": "^5.0.0",
|
|
30
|
+
"@quenty/brio": "^6.0.0",
|
|
31
|
+
"@quenty/inputkeymaputils": "^5.0.0",
|
|
32
|
+
"@quenty/inputmode": "^5.0.0",
|
|
33
|
+
"@quenty/loader": "^5.0.0",
|
|
34
|
+
"@quenty/maid": "^2.3.0",
|
|
35
|
+
"@quenty/rx": "^5.0.0",
|
|
36
|
+
"@quenty/signal": "^2.2.0",
|
|
37
|
+
"@quenty/statestack": "^6.0.0",
|
|
38
|
+
"@quenty/table": "^3.0.0",
|
|
39
|
+
"@quenty/valueobject": "^5.0.0"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "9f7eaea7543c33c89d2e32c38491b13f9271f4f7"
|
|
45
45
|
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
local require = require(script.Parent.loader).load(script)
|
|
7
7
|
|
|
8
8
|
local BaseObject = require("BaseObject")
|
|
9
|
-
local
|
|
10
|
-
local InputModeSelector = require("InputModeSelector")
|
|
9
|
+
local InputKeyMapList = require("InputKeyMapList")
|
|
11
10
|
local Set = require("Set")
|
|
11
|
+
local Rx = require("Rx")
|
|
12
12
|
|
|
13
13
|
local InputListScoreHelper = setmetatable({}, BaseObject)
|
|
14
14
|
InputListScoreHelper.ClassName = "InputListScoreHelper"
|
|
@@ -21,15 +21,21 @@ function InputListScoreHelper.new(provider, scoredAction, inputKeyMapList)
|
|
|
21
21
|
self._scoredAction = assert(scoredAction, "No scoredAction")
|
|
22
22
|
self._inputKeyMapList = assert(inputKeyMapList, "No inputKeyMapList")
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
assert(InputKeyMapList.isInputKeyMapList(inputKeyMapList), "Bad inputKeyMapList")
|
|
25
25
|
|
|
26
|
-
self.
|
|
27
|
-
self._maid:GiveTask(self._modeSelector)
|
|
26
|
+
self._currentTypes = {}
|
|
28
27
|
|
|
29
|
-
self._maid:GiveTask(self.
|
|
30
|
-
|
|
28
|
+
self._maid:GiveTask(self._inputKeyMapList:ObserveActiveInputKeyMap():Pipe({
|
|
29
|
+
Rx.switchMap(function(activeInputKeyMap)
|
|
30
|
+
if activeInputKeyMap then
|
|
31
|
+
return activeInputKeyMap:ObserveInputTypesList()
|
|
32
|
+
else
|
|
33
|
+
return Rx.of({})
|
|
34
|
+
end
|
|
35
|
+
end)
|
|
36
|
+
}):Subscribe(function(inputTypeList)
|
|
37
|
+
self:_updateInputTypeSet(inputTypeList)
|
|
31
38
|
end))
|
|
32
|
-
self:_handleModeChanged()
|
|
33
39
|
|
|
34
40
|
self._maid:GiveTask(function()
|
|
35
41
|
local current, _ = next(self._currentTypes)
|
|
@@ -45,14 +51,11 @@ function InputListScoreHelper.new(provider, scoredAction, inputKeyMapList)
|
|
|
45
51
|
return self
|
|
46
52
|
end
|
|
47
53
|
|
|
48
|
-
function InputListScoreHelper:
|
|
49
|
-
local currentMode = self._modeSelector:GetActiveMode()
|
|
50
|
-
local inputTypeSet = InputKeyMapUtils.getInputTypeSetForMode(self._inputKeyMapList, currentMode)
|
|
51
|
-
|
|
54
|
+
function InputListScoreHelper:_updateInputTypeSet(inputTypeList)
|
|
52
55
|
local remaining = Set.copy(self._currentTypes)
|
|
53
56
|
|
|
54
57
|
-- Register inputTypes
|
|
55
|
-
for
|
|
58
|
+
for _, inputType in pairs(inputTypeList) do
|
|
56
59
|
if not self._currentTypes[inputType] then
|
|
57
60
|
self._currentTypes[inputType] = true
|
|
58
61
|
|
|
@@ -70,8 +73,6 @@ function InputListScoreHelper:_handleModeChanged()
|
|
|
70
73
|
for inputType, _ in pairs(remaining) do
|
|
71
74
|
self:_unregisterAction(inputType)
|
|
72
75
|
end
|
|
73
|
-
|
|
74
|
-
self._currentTypes = inputTypeSet
|
|
75
76
|
end
|
|
76
77
|
|
|
77
78
|
function InputListScoreHelper:_unregisterAction(inputType)
|
|
@@ -81,6 +81,7 @@ function ScoredActionPicker:AddAction(action)
|
|
|
81
81
|
assert(type(action) == "table", "Bad action")
|
|
82
82
|
|
|
83
83
|
self._actionSet[action] = true
|
|
84
|
+
self:Update()
|
|
84
85
|
end
|
|
85
86
|
|
|
86
87
|
function ScoredActionPicker:RemoveAction(action)
|
|
@@ -91,6 +92,7 @@ function ScoredActionPicker:RemoveAction(action)
|
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
self._actionSet[action] = nil
|
|
95
|
+
self:Update()
|
|
94
96
|
end
|
|
95
97
|
|
|
96
98
|
function ScoredActionPicker:HasActions()
|
|
@@ -8,7 +8,7 @@ local BaseObject = require("BaseObject")
|
|
|
8
8
|
local ScoredActionPicker = require("ScoredActionPicker")
|
|
9
9
|
local Table = require("Table")
|
|
10
10
|
local TouchButtonScoredActionPicker = require("TouchButtonScoredActionPicker")
|
|
11
|
-
local
|
|
11
|
+
local InputTypeUtils = require("InputTypeUtils")
|
|
12
12
|
|
|
13
13
|
local MAX_ACTION_LIST_SIZE_BEFORE_WARN = 25
|
|
14
14
|
|
|
@@ -25,14 +25,14 @@ function ScoredActionPickerProvider.new()
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
function ScoredActionPickerProvider:FindPicker(inputType)
|
|
28
|
-
local key =
|
|
28
|
+
local key = InputTypeUtils.getUniqueKeyForInputType(inputType)
|
|
29
29
|
return self._scoredActionPickers[key]
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
--inputType is most likely an enum, but could be a string!
|
|
33
33
|
function ScoredActionPickerProvider:GetOrCreatePicker(inputType)
|
|
34
34
|
assert(inputType, "Bad inputType")
|
|
35
|
-
local key =
|
|
35
|
+
local key = InputTypeUtils.getUniqueKeyForInputType(inputType)
|
|
36
36
|
|
|
37
37
|
if self._scoredActionPickers[key] then
|
|
38
38
|
return self._scoredActionPickers[key]
|
|
@@ -14,6 +14,7 @@ local ScoredActionPickerProvider = require("ScoredActionPickerProvider")
|
|
|
14
14
|
local Maid = require("Maid")
|
|
15
15
|
local InputListScoreHelper = require("InputListScoreHelper")
|
|
16
16
|
local Observable = require("Observable")
|
|
17
|
+
local InputKeyMapList = require("InputKeyMapList")
|
|
17
18
|
|
|
18
19
|
local ScoredActionService = {}
|
|
19
20
|
|
|
@@ -46,7 +47,7 @@ end
|
|
|
46
47
|
@return ScoredAction
|
|
47
48
|
]=]
|
|
48
49
|
function ScoredActionService:GetScoredAction(inputKeyMapList)
|
|
49
|
-
assert(
|
|
50
|
+
assert(InputKeyMapList.isInputKeyMapList(inputKeyMapList), "Bad inputKeyMapList")
|
|
50
51
|
assert(self._provider, "Not initialized")
|
|
51
52
|
|
|
52
53
|
local scoredAction = ScoredAction.new()
|