@quenty/rogue-properties 11.22.0-canary.544.de8fcee.0 → 11.22.1-canary.545.2374fb2.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 CHANGED
@@ -3,7 +3,26 @@
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
- # [11.22.0-canary.544.de8fcee.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rogue-properties@11.21.4...@quenty/rogue-properties@11.22.0-canary.544.de8fcee.0) (2025-04-01)
6
+ ## [11.22.1-canary.545.2374fb2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rogue-properties@11.22.0...@quenty/rogue-properties@11.22.1-canary.545.2374fb2.0) (2025-04-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
12
+
13
+
14
+
15
+
16
+
17
+ # [11.22.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rogue-properties@11.21.5...@quenty/rogue-properties@11.22.0) (2025-04-02)
18
+
19
+ **Note:** Version bump only for package @quenty/rogue-properties
20
+
21
+
22
+
23
+
24
+
25
+ ## [11.21.5](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rogue-properties@11.21.4...@quenty/rogue-properties@11.21.5) (2025-03-31)
7
26
 
8
27
  **Note:** Version bump only for package @quenty/rogue-properties
9
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/rogue-properties",
3
- "version": "11.22.0-canary.544.de8fcee.0",
3
+ "version": "11.22.1-canary.545.2374fb2.0",
4
4
  "description": "Roguelike properties which can be modified by external provides",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -24,33 +24,33 @@
24
24
  "Quenty"
25
25
  ],
26
26
  "dependencies": {
27
- "@quenty/adorneedata": "7.18.0-canary.544.de8fcee.0",
28
- "@quenty/baseobject": "10.8.0",
29
- "@quenty/binder": "14.19.0-canary.544.de8fcee.0",
30
- "@quenty/brio": "14.17.0-canary.544.de8fcee.0",
31
- "@quenty/defaultvalueutils": "1.2.0",
32
- "@quenty/ducktype": "5.8.1",
33
- "@quenty/instanceutils": "13.17.0-canary.544.de8fcee.0",
34
- "@quenty/jsonutils": "10.10.1",
35
- "@quenty/linkutils": "13.17.0-canary.544.de8fcee.0",
36
- "@quenty/loader": "10.8.0",
37
- "@quenty/maid": "3.4.0",
38
- "@quenty/observablecollection": "12.20.0-canary.544.de8fcee.0",
39
- "@quenty/rx": "13.17.0-canary.544.de8fcee.0",
40
- "@quenty/rxbinderutils": "14.19.0-canary.544.de8fcee.0",
41
- "@quenty/rxsignal": "7.17.0-canary.544.de8fcee.0",
42
- "@quenty/servicebag": "11.11.1",
43
- "@quenty/signal": "7.10.0",
44
- "@quenty/spring": "10.8.1",
45
- "@quenty/string": "3.3.1",
46
- "@quenty/table": "3.7.1",
47
- "@quenty/tie": "10.20.0-canary.544.de8fcee.0",
48
- "@quenty/valuebaseutils": "13.17.0-canary.544.de8fcee.0",
49
- "@quenty/valueobject": "13.17.0-canary.544.de8fcee.0",
27
+ "@quenty/adorneedata": "7.18.1-canary.545.2374fb2.0",
28
+ "@quenty/baseobject": "10.8.1-canary.545.2374fb2.0",
29
+ "@quenty/binder": "14.19.1-canary.545.2374fb2.0",
30
+ "@quenty/brio": "14.17.1-canary.545.2374fb2.0",
31
+ "@quenty/defaultvalueutils": "1.2.1-canary.545.2374fb2.0",
32
+ "@quenty/ducktype": "5.8.2-canary.545.2374fb2.0",
33
+ "@quenty/instanceutils": "13.17.1-canary.545.2374fb2.0",
34
+ "@quenty/jsonutils": "10.10.2-canary.545.2374fb2.0",
35
+ "@quenty/linkutils": "13.17.1-canary.545.2374fb2.0",
36
+ "@quenty/loader": "10.8.1-canary.545.2374fb2.0",
37
+ "@quenty/maid": "3.4.1-canary.545.2374fb2.0",
38
+ "@quenty/observablecollection": "12.20.1-canary.545.2374fb2.0",
39
+ "@quenty/rx": "13.17.1-canary.545.2374fb2.0",
40
+ "@quenty/rxbinderutils": "14.19.1-canary.545.2374fb2.0",
41
+ "@quenty/rxsignal": "7.17.1-canary.545.2374fb2.0",
42
+ "@quenty/servicebag": "11.11.2-canary.545.2374fb2.0",
43
+ "@quenty/signal": "7.10.1-canary.545.2374fb2.0",
44
+ "@quenty/spring": "10.8.2-canary.545.2374fb2.0",
45
+ "@quenty/string": "3.3.2-canary.545.2374fb2.0",
46
+ "@quenty/table": "3.7.2-canary.545.2374fb2.0",
47
+ "@quenty/tie": "10.20.1-canary.545.2374fb2.0",
48
+ "@quenty/valuebaseutils": "13.17.1-canary.545.2374fb2.0",
49
+ "@quenty/valueobject": "13.17.1-canary.545.2374fb2.0",
50
50
  "@quentystudios/t": "^3.0.0"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "de8fcee995fcdae464964357b4c770c03f4c7e03"
55
+ "gitHead": "2374fb2b043cfbe0e9b507b3316eec46a4e353a0"
56
56
  }
@@ -10,11 +10,11 @@ local DefaultValueUtils = require("DefaultValueUtils")
10
10
 
11
11
  local RoguePropertyArrayUtils = {}
12
12
 
13
- function RoguePropertyArrayUtils.getNameFromIndex(index)
13
+ function RoguePropertyArrayUtils.getNameFromIndex(index: number): string
14
14
  return RoguePropertyArrayConstants.ARRAY_ENTRY_PERFIX .. tostring(index)
15
15
  end
16
16
 
17
- function RoguePropertyArrayUtils.getIndexFromName(name)
17
+ function RoguePropertyArrayUtils.getIndexFromName(name: string): number?
18
18
  return tonumber(String.removePrefix(name, RoguePropertyArrayConstants.ARRAY_ENTRY_PERFIX))
19
19
  end
20
20
 
@@ -26,7 +26,7 @@ function RoguePropertyArrayUtils.createRequiredPropertyDefinitionFromArray(array
26
26
  return nil, "Missing array data"
27
27
  end
28
28
 
29
- for index, item in pairs(arrayData) do
29
+ for index, item in arrayData do
30
30
  if typeof(item) ~= expectedType then
31
31
  expectedType = nil
32
32
  -- TODO: Maybe union?
@@ -38,7 +38,7 @@ function RoguePropertyArrayUtils.createRequiredPropertyDefinitionFromArray(array
38
38
  end
39
39
 
40
40
  function RoguePropertyArrayUtils.createRequiredTableDefinition(arrayData, parentPropertyTableDefinition)
41
- local RoguePropertyTableDefinition = require("RoguePropertyTableDefinition")
41
+ local RoguePropertyTableDefinition = (require :: any)("RoguePropertyTableDefinition")
42
42
 
43
43
  local entry = arrayData[1]
44
44
  if type(entry) ~= "table" then
@@ -51,7 +51,7 @@ function RoguePropertyArrayUtils.createRequiredTableDefinition(arrayData, parent
51
51
  propertyDefinition:SetParentPropertyTableDefinition(parentPropertyTableDefinition)
52
52
  propertyDefinition:SetDefaultValue(DefaultValueUtils.toDefaultValue(entry))
53
53
 
54
- for _, item in pairs(arrayData) do
54
+ for _, item in arrayData do
55
55
  local canAssign, message = propertyDefinition:CanAssign(item, true)
56
56
  if not canAssign then
57
57
  return nil, string.format("Cannot assign due to %q", message)
@@ -61,8 +61,11 @@ function RoguePropertyArrayUtils.createRequiredTableDefinition(arrayData, parent
61
61
  return propertyDefinition
62
62
  end
63
63
 
64
- function RoguePropertyArrayUtils.createRequiredPropertyDefinitionFromType(expectedType, parentPropertyTableDefinition)
65
- local RoguePropertyDefinition = require("RoguePropertyDefinition")
64
+ function RoguePropertyArrayUtils.createRequiredPropertyDefinitionFromType(
65
+ expectedType: string,
66
+ parentPropertyTableDefinition
67
+ )
68
+ local RoguePropertyDefinition = (require :: any)("RoguePropertyDefinition")
66
69
 
67
70
  local default = DefaultValueUtils.getDefaultValueForType(expectedType)
68
71
  if default == nil then
@@ -77,13 +80,13 @@ function RoguePropertyArrayUtils.createRequiredPropertyDefinitionFromType(expect
77
80
  return propertyDefinition
78
81
  end
79
82
 
80
- function RoguePropertyArrayUtils.createDefinitionsFromContainer(container, parentPropertyTableDefinition)
81
- local RoguePropertyTableDefinition = require("RoguePropertyTableDefinition")
82
- local RoguePropertyDefinition = require("RoguePropertyDefinition")
83
+ function RoguePropertyArrayUtils.createDefinitionsFromContainer(container: Instance, parentPropertyTableDefinition)
84
+ local RoguePropertyTableDefinition = (require :: any)("RoguePropertyTableDefinition")
85
+ local RoguePropertyDefinition = (require :: any)("RoguePropertyDefinition")
83
86
 
84
87
  local value = {}
85
88
 
86
- for _, item in pairs(container:GetChildren()) do
89
+ for _, item in container:GetChildren() do
87
90
  local index = RoguePropertyArrayUtils.getIndexFromName(item.Name)
88
91
  if not index then
89
92
  continue
@@ -108,10 +111,10 @@ function RoguePropertyArrayUtils.createDefinitionsFromContainer(container, paren
108
111
  return value
109
112
  end
110
113
 
111
- function RoguePropertyArrayUtils.getDefaultValueMapFromContainer(container)
114
+ function RoguePropertyArrayUtils.getDefaultValueMapFromContainer(container: Instance)
112
115
  local value = {}
113
116
 
114
- for _, item in pairs(container:GetChildren()) do
117
+ for _, item in container:GetChildren() do
115
118
  local index = RoguePropertyArrayUtils.getIndexFromName(item.Name)
116
119
  if index then
117
120
  if item:IsA("Folder") then
@@ -132,11 +135,11 @@ function RoguePropertyArrayUtils.getDefaultValueMapFromContainer(container)
132
135
  end
133
136
 
134
137
  function RoguePropertyArrayUtils.createDefinitionsFromArrayData(arrayData, propertyTableDefinition)
135
- local RoguePropertyTableDefinition = require("RoguePropertyTableDefinition")
136
- local RoguePropertyDefinition = require("RoguePropertyDefinition")
138
+ local RoguePropertyTableDefinition = (require :: any)("RoguePropertyTableDefinition")
139
+ local RoguePropertyDefinition = (require :: any)("RoguePropertyDefinition")
137
140
 
138
141
  local definitions = {}
139
- for index, defaultValue in pairs(arrayData) do
142
+ for index, defaultValue in arrayData do
140
143
  local name = RoguePropertyArrayUtils.getNameFromIndex(index)
141
144
 
142
145
  if type(defaultValue) == "table" then
@@ -4,7 +4,6 @@
4
4
  @class RoguePropertyCache
5
5
  ]=]
6
6
 
7
- local require = require(script.Parent.loader).load(script)
8
7
 
9
8
  local RoguePropertyCache = {}
10
9
  RoguePropertyCache.ClassName = "RoguePropertyCache"
@@ -5,16 +5,16 @@
5
5
  @class RoguePropertyCacheService
6
6
  ]=]
7
7
 
8
- local RunService = game:GetService("RunService")
9
-
10
8
  local require = require(script.Parent.loader).load(script)
9
+ local RunService = game:GetService("RunService")
11
10
 
12
11
  local RoguePropertyCache = require("RoguePropertyCache")
12
+ local _ServiceBag = require("ServiceBag")
13
13
 
14
14
  local RoguePropertyCacheService = {}
15
15
  RoguePropertyCacheService.ServiceName = "RoguePropertyCacheService"
16
16
 
17
- function RoguePropertyCacheService:Init(serviceBag)
17
+ function RoguePropertyCacheService:Init(serviceBag: _ServiceBag.ServiceBag)
18
18
  assert(not self._serviceBag, "Already initialized")
19
19
  self._serviceBag = assert(serviceBag, "No serviceBag")
20
20
 
@@ -32,7 +32,7 @@ function RoguePropertyDefinition:SetDefaultValue(defaultValue)
32
32
  self._encodedDefaultValue = RoguePropertyUtils.encodeProperty(self, self._defaultValue)
33
33
  end
34
34
 
35
- function RoguePropertyDefinition.isRoguePropertyDefinition(value)
35
+ function RoguePropertyDefinition.isRoguePropertyDefinition(value: any): boolean
36
36
  return DuckTypeUtils.isImplementation(RoguePropertyDefinition, value)
37
37
  end
38
38
 
@@ -84,7 +84,7 @@ function RoguePropertyDefinition:CanAssign(value, _strict)
84
84
  end
85
85
  end
86
86
 
87
- function RoguePropertyDefinition:SetName(name)
87
+ function RoguePropertyDefinition:SetName(name: string)
88
88
  assert(type(name) == "string", "Bad name")
89
89
 
90
90
  self._name = name
@@ -20,7 +20,7 @@ function RoguePropertyDefinitionArrayHelper.new(propertyTableDefinition, default
20
20
  return self
21
21
  end
22
22
 
23
- function RoguePropertyDefinitionArrayHelper:IsArray()
23
+ function RoguePropertyDefinitionArrayHelper:IsArray(): boolean
24
24
  return self._defaultArrayData ~= nil
25
25
  end
26
26
 
@@ -37,7 +37,8 @@ function RoguePropertyDefinitionArrayHelper:GetDefaultDefinitions()
37
37
  return self._defaultDefinitions
38
38
  end
39
39
 
40
- self._defaultDefinitions = RoguePropertyArrayUtils.createDefinitionsFromArrayData(self._defaultArrayData, self._propertyTableDefinition)
40
+ self._defaultDefinitions =
41
+ RoguePropertyArrayUtils.createDefinitionsFromArrayData(self._defaultArrayData, self._propertyTableDefinition)
41
42
  return self._defaultDefinitions
42
43
  end
43
44
 
@@ -45,16 +46,22 @@ function RoguePropertyDefinitionArrayHelper:GetRequiredPropertyDefinition()
45
46
  return self._requiredPropertyDefinition
46
47
  end
47
48
 
48
- function RoguePropertyDefinitionArrayHelper:CanAssign(arrayValue, strict)
49
+ function RoguePropertyDefinitionArrayHelper:CanAssign(arrayValue, strict): boolean
49
50
  if type(arrayValue) ~= "table" then
50
51
  return false, string.format("got %q, expected %q", self._valueType, typeof(arrayValue))
51
52
  end
52
53
 
53
- for key, value in pairs(arrayValue) do
54
+ for key, value in arrayValue do
54
55
  if type(key) == "number" then
55
56
  local canAssign, message = self._requiredPropertyDefinition:CanAssign(value, strict)
56
57
  if not canAssign then
57
- return false, string.format("Array at %s was %q, cannot assign due to %q", tostring(key), typeof(value), tostring(message))
58
+ return false,
59
+ string.format(
60
+ "Array at %s was %q, cannot assign due to %q",
61
+ tostring(key),
62
+ typeof(value),
63
+ tostring(message)
64
+ )
58
65
  end
59
66
  end
60
67
  end
@@ -62,7 +69,7 @@ function RoguePropertyDefinitionArrayHelper:CanAssign(arrayValue, strict)
62
69
  return true
63
70
  end
64
71
 
65
- function RoguePropertyDefinitionArrayHelper:CanAssignAsArrayMember(value, strict)
72
+ function RoguePropertyDefinitionArrayHelper:CanAssignAsArrayMember(value, strict): boolean
66
73
  assert(type(strict) == "boolean", "Bad strict")
67
74
 
68
75
  return self._requiredPropertyDefinition:CanAssign(value, strict)
@@ -6,22 +6,23 @@
6
6
  local require = require(script.Parent.loader).load(script)
7
7
 
8
8
  local DuckTypeUtils = require("DuckTypeUtils")
9
+ local RoguePropertyArrayUtils = (require :: any)("RoguePropertyArrayUtils")
10
+ local RoguePropertyCacheService = require("RoguePropertyCacheService")
9
11
  local RoguePropertyDefinition = require("RoguePropertyDefinition")
10
12
  local RoguePropertyDefinitionArrayHelper = require("RoguePropertyDefinitionArrayHelper")
13
+ local RoguePropertyService = require("RoguePropertyService")
11
14
  local RoguePropertyTable = require("RoguePropertyTable")
12
15
  local RxBrioUtils = require("RxBrioUtils")
13
16
  local RxInstanceUtils = require("RxInstanceUtils")
14
17
  local ServiceBag = require("ServiceBag")
15
- local RoguePropertyService = require("RoguePropertyService")
16
- local RoguePropertyArrayUtils = require("RoguePropertyArrayUtils")
17
18
  local Set = require("Set")
18
- local RoguePropertyCacheService = require("RoguePropertyCacheService")
19
+ local _Table = require("Table")
19
20
 
20
21
  local RoguePropertyTableDefinition = {} -- Inherits from RoguePropertyDefinition
21
22
  RoguePropertyTableDefinition.ClassName = "RoguePropertyTableDefinition"
22
23
  RoguePropertyTableDefinition.__index = RoguePropertyTableDefinition
23
24
 
24
- function RoguePropertyTableDefinition.new(tableName, defaultValueTable)
25
+ function RoguePropertyTableDefinition.new(tableName: string?, defaultValueTable: _Table.Map<string, any>?)
25
26
  local self = setmetatable(RoguePropertyDefinition.new(), RoguePropertyTableDefinition)
26
27
 
27
28
  if tableName then
@@ -39,7 +40,7 @@ function RoguePropertyTableDefinition.isRoguePropertyTableDefinition(value): boo
39
40
  return DuckTypeUtils.isImplementation(RoguePropertyTableDefinition, value)
40
41
  end
41
42
 
42
- function RoguePropertyTableDefinition:SetDefaultValue(defaultValueTable)
43
+ function RoguePropertyTableDefinition:SetDefaultValue(defaultValueTable: _Table.Map<string, any>?)
43
44
  assert(type(defaultValueTable) == "table", "Bad defaultValueTable")
44
45
 
45
46
  RoguePropertyDefinition.SetDefaultValue(self, defaultValueTable)
@@ -48,7 +49,7 @@ function RoguePropertyTableDefinition:SetDefaultValue(defaultValueTable)
48
49
 
49
50
  local defaultArrayData = {}
50
51
 
51
- for key, defaultValue in pairs(defaultValueTable) do
52
+ for key, defaultValue in defaultValueTable do
52
53
  if type(key) == "number" then
53
54
  table.insert(defaultArrayData, defaultValue)
54
55
  else
@@ -89,7 +90,7 @@ function RoguePropertyTableDefinition:SetDefaultValue(defaultValueTable)
89
90
  end
90
91
  end
91
92
 
92
- function RoguePropertyTableDefinition:CanAssign(mainValue, strict: boolean): boolean
93
+ function RoguePropertyTableDefinition:CanAssign(mainValue, strict: boolean): (boolean, string?)
93
94
  assert(type(strict) == "boolean", "Bad strict")
94
95
 
95
96
  if type(mainValue) ~= "table" then
@@ -102,14 +103,14 @@ function RoguePropertyTableDefinition:CanAssign(mainValue, strict: boolean): boo
102
103
  )
103
104
  end
104
105
 
105
- local remainingKeys
106
+ local remainingKeys: Set.Set<string>
106
107
  if strict then
107
108
  remainingKeys = Set.fromKeys(self._definitionMap)
108
109
  else
109
110
  remainingKeys = {}
110
111
  end
111
112
 
112
- for key, value in pairs(mainValue) do
113
+ for key, value in mainValue do
113
114
  remainingKeys[key] = nil
114
115
 
115
116
  if type(key) == "number" then
@@ -158,13 +159,13 @@ function RoguePropertyTableDefinition:CanAssign(mainValue, strict: boolean): boo
158
159
  return false,
159
160
  string.format(
160
161
  "Had %d unassigned keys %q while assigning to %q",
161
- #remainingKeys,
162
- table.concat(remainingKeys, ", "),
162
+ Set.count(remainingKeys),
163
+ table.concat(Set.toList(remainingKeys), ", "),
163
164
  self:GetFullName()
164
165
  )
165
166
  end
166
167
 
167
- return true
168
+ return true, nil
168
169
  end
169
170
 
170
171
  function RoguePropertyTableDefinition:GetDefinitionArrayHelper()
@@ -195,7 +196,7 @@ end
195
196
  @param adornee Instance
196
197
  @return RoguePropertyTable
197
198
  ]=]
198
- function RoguePropertyTableDefinition:Get(serviceBag, adornee)
199
+ function RoguePropertyTableDefinition:Get(serviceBag, adornee: Instance)
199
200
  assert(ServiceBag.isServiceBag(serviceBag), "Bad serviceBag")
200
201
  assert(typeof(adornee) == "Instance", "Bad adornee")
201
202
 
@@ -288,7 +289,7 @@ function RoguePropertyTableDefinition:GetOrCreateInstance(parent)
288
289
  return folder
289
290
  end
290
291
 
291
- function RoguePropertyTableDefinition:__index(index)
292
+ function RoguePropertyTableDefinition:__index(index: string)
292
293
  assert(type(index) == "string", "Bad index")
293
294
 
294
295
  if index == "_definitionMap" or index == "_arrayDefinitionHelper" or index == "_parentPropertyTableDefinition" then
@@ -318,6 +319,8 @@ function RoguePropertyTableDefinition:__index(index)
318
319
  else
319
320
  error(string.format("Bad definition %q - Not an array", tostring(index)))
320
321
  end
322
+ else
323
+ error(string.format("Bad index %q", tostring(index)))
321
324
  end
322
325
  end
323
326
 
@@ -35,7 +35,7 @@ function RogueProperty.new(adornee, serviceBag, definition)
35
35
  return setmetatable(self, RogueProperty)
36
36
  end
37
37
 
38
- function RogueProperty:SetCanInitialize(canInitialize)
38
+ function RogueProperty:SetCanInitialize(canInitialize: boolean)
39
39
  assert(type(canInitialize) == "boolean", "Bad canInitialize")
40
40
 
41
41
  if rawget(self, "_canInitialize") ~= canInitialize then
@@ -154,7 +154,7 @@ function RogueProperty:GetValue()
154
154
 
155
155
  local current = self:_decodeValue(propObj.Value)
156
156
 
157
- for _, rogueModifier in pairs(self:GetRogueModifiers()) do
157
+ for _, rogueModifier in self:GetRogueModifiers() do
158
158
  current = rogueModifier:GetModifiedVersion(current)
159
159
  end
160
160
 
@@ -174,7 +174,7 @@ function RogueProperty:GetRogueModifiers()
174
174
  local found = RogueModifierInterface:GetChildren(propObj)
175
175
 
176
176
  local orders = {}
177
- for _, item in pairs(found) do
177
+ for _, item in found do
178
178
  orders[item] = item.Order.Value
179
179
  end
180
180
  table.sort(found, function(a, b)
@@ -190,23 +190,25 @@ function RogueProperty:_observeModifierSortedList()
190
190
 
191
191
  local sortedList = topMaid:Add(ObservableSortedList.new())
192
192
 
193
- topMaid:GiveTask(self:_observeBaseValueBrio():Pipe({
194
- RxBrioUtils.flatMapBrio(function(baseValue)
195
- return RogueModifierInterface:ObserveChildrenBrio(baseValue)
196
- end);
197
- }):Subscribe(function(brio)
198
- if brio:IsDead() then
199
- return
200
- end
201
- local maid, rogueModifier = brio:ToMaidAndValue()
202
- maid:GiveTask(sortedList:Add(rogueModifier, rogueModifier.Order:Observe()))
203
- end))
193
+ topMaid:GiveTask(self:_observeBaseValueBrio()
194
+ :Pipe({
195
+ RxBrioUtils.flatMapBrio(function(baseValue)
196
+ return RogueModifierInterface:ObserveChildrenBrio(baseValue)
197
+ end),
198
+ })
199
+ :Subscribe(function(brio)
200
+ if brio:IsDead() then
201
+ return
202
+ end
203
+ local maid, rogueModifier = brio:ToMaidAndValue()
204
+ maid:GiveTask(sortedList:Add(rogueModifier, rogueModifier.Order:Observe()))
205
+ end))
204
206
 
205
207
  sub:Fire(sortedList)
206
208
 
207
209
  return topMaid
208
210
  end):Pipe({
209
- Rx.cache();
211
+ Rx.cache(),
210
212
  })
211
213
  end
212
214
 
@@ -214,19 +216,19 @@ function RogueProperty:Observe()
214
216
  local observeInitialValue = self:_observeBaseValueBrio():Pipe({
215
217
  RxBrioUtils.switchMapBrio(function(baseValue)
216
218
  return RxInstanceUtils.observeProperty(baseValue, "Value")
217
- end);
218
- RxBrioUtils.emitOnDeath(self._definition:GetDefaultValue());
219
- Rx.defaultsTo(self._definition:GetDefaultValue());
220
- Rx.distinct();
219
+ end),
220
+ RxBrioUtils.emitOnDeath(self._definition:GetDefaultValue()),
221
+ Rx.defaultsTo(self._definition:GetDefaultValue()),
222
+ Rx.distinct(),
221
223
  })
222
224
 
223
225
  return self:_observeModifierSortedList():Pipe({
224
226
  Rx.switchMap(function(sortedList)
225
- return sortedList:Observe()
227
+ return sortedList:Observe()
226
228
  end);
227
229
  Rx.switchMap(function(rogueModifierList)
228
- local current = observeInitialValue
229
- for _, rogueModifier in pairs(rogueModifierList) do
230
+ local current = observeInitialValue
231
+ for _, rogueModifier in rogueModifierList do
230
232
  current = rogueModifier:ObserveModifiedVersion(current)
231
233
  end
232
234
  return current
@@ -269,7 +271,7 @@ function RogueProperty:CreateMultiplier(amount, source)
269
271
  return multiplier
270
272
  end
271
273
 
272
- function RogueProperty:CreateAdditive(amount, source)
274
+ function RogueProperty:CreateAdditive(amount: number, source)
273
275
  assert(type(amount) == "number", "Bad amount")
274
276
 
275
277
  local baseValue = self:GetBaseValueObject()
@@ -22,13 +22,13 @@ function RoguePropertyArrayHelper.new(serviceBag, arrayDefinitionHelper, roguePr
22
22
  return self
23
23
  end
24
24
 
25
- function RoguePropertyArrayHelper:SetCanInitialize(canInitialize)
25
+ function RoguePropertyArrayHelper:SetCanInitialize(canInitialize: boolean)
26
26
  if canInitialize then
27
27
  self:GetArrayRogueProperties()
28
28
  end
29
29
  end
30
30
 
31
- function RoguePropertyArrayHelper:GetArrayRogueProperty(index)
31
+ function RoguePropertyArrayHelper:GetArrayRogueProperty(index: number)
32
32
  assert(type(index) == "number", "Bad index")
33
33
 
34
34
  -- TODO: Maybe return something general for that index
@@ -47,7 +47,7 @@ function RoguePropertyArrayHelper:GetArrayRogueProperties()
47
47
  if not (container and container:GetAttribute("HasInitializedArrayComponent")) then
48
48
  container:SetAttribute("HasInitializedArrayComponent", true)
49
49
  local properties = self:_getDefaultRogueProperties()
50
- for _, rogueProperty in pairs(properties) do
50
+ for _, rogueProperty in properties do
51
51
  -- Force initialization once and only once...
52
52
  rogueProperty:SetCanInitialize(true)
53
53
  rogueProperty:SetCanInitialize(false)
@@ -65,7 +65,7 @@ function RoguePropertyArrayHelper:GetArrayRogueProperties()
65
65
  local definitions = RoguePropertyArrayUtils.createDefinitionsFromContainer(container, self._arrayDefinitionHelper:GetPropertyTableDefinition())
66
66
  local rogueProperties = {}
67
67
 
68
- for index, definition in pairs(definitions) do
68
+ for index, definition in definitions do
69
69
  local property = definition:Get(self._serviceBag, adornee)
70
70
  property:SetCanInitialize(false) -- Explicitly not going to reinitialize
71
71
  rogueProperties[index] = property
@@ -81,7 +81,7 @@ function RoguePropertyArrayHelper:_getDefaultRogueProperties()
81
81
 
82
82
  local defaultRogueProperties = {}
83
83
  local adornee = self._roguePropertyTable:GetAdornee()
84
- for _, definition in pairs(self._arrayDefinitionHelper:GetDefaultDefinitions()) do
84
+ for _, definition in self._arrayDefinitionHelper:GetDefaultDefinitions() do
85
85
  local property = definition:Get(self._serviceBag, adornee)
86
86
  table.insert(defaultRogueProperties, property)
87
87
  end
@@ -105,7 +105,7 @@ function RoguePropertyArrayHelper:SetArrayBaseData(arrayData)
105
105
  local adornee = self._roguePropertyTable:GetAdornee()
106
106
  local definitions = RoguePropertyArrayUtils.createDefinitionsFromArrayData(arrayData, parentPropertyTableDefinition)
107
107
 
108
- for index, definition in pairs(definitions) do
108
+ for index, definition in definitions do
109
109
  if available[index] and available[index]:GetDefinition():GetValueType() == definition:GetValueType() then
110
110
  available[index]:SetBaseValue(definition:GetDefaultValue())
111
111
  else
@@ -140,7 +140,7 @@ function RoguePropertyArrayHelper:SetArrayData(arrayData)
140
140
  local adornee = self._roguePropertyTable:GetAdornee()
141
141
  local definitions = RoguePropertyArrayUtils.createDefinitionsFromArrayData(arrayData, parentPropertyTableDefinition)
142
142
 
143
- for index, definition in pairs(definitions) do
143
+ for index, definition in definitions do
144
144
  if available[index] and available[index]:GetDefinition():GetValueType() == definition:GetValueType() then
145
145
  available[index]:SetValue(definition:GetDefaultValue())
146
146
  else
@@ -159,7 +159,7 @@ function RoguePropertyArrayHelper:SetArrayData(arrayData)
159
159
  end
160
160
 
161
161
  function RoguePropertyArrayHelper:_removeUnspecified(container, definitions)
162
- for _, item in pairs(container:GetChildren()) do
162
+ for _, item in container:GetChildren() do
163
163
  local index = RoguePropertyArrayUtils.getIndexFromName(item.Name)
164
164
  if index then
165
165
  if not definitions[index] then
@@ -169,7 +169,6 @@ function RoguePropertyArrayHelper:_removeUnspecified(container, definitions)
169
169
  end
170
170
  end
171
171
 
172
-
173
172
  function RoguePropertyArrayHelper:GetArrayBaseValues()
174
173
  local result = {}
175
174
  for index, rogueProperty in pairs(self:GetArrayRogueProperties()) do
@@ -192,7 +191,7 @@ function RoguePropertyArrayHelper:ObserveArrayValues()
192
191
  -- TODO: Allow for observing
193
192
  local observables = {}
194
193
 
195
- for _, rogueProperty in pairs(self:GetArrayRogueProperties()) do
194
+ for _, rogueProperty in self:GetArrayRogueProperties() do
196
195
  table.insert(observables, rogueProperty:Observe())
197
196
  end
198
197
 
@@ -12,7 +12,7 @@ local RoguePropertyTable = {} -- inherits from RogueProperty
12
12
  RoguePropertyTable.ClassName = "RoguePropertyTable"
13
13
  RoguePropertyTable.__index = RoguePropertyTable
14
14
 
15
- function RoguePropertyTable.new(adornee, serviceBag, roguePropertyTableDefinition)
15
+ function RoguePropertyTable.new(adornee: Instance, serviceBag, roguePropertyTableDefinition)
16
16
  local self = setmetatable(RogueProperty.new(adornee, serviceBag, roguePropertyTableDefinition), RoguePropertyTable)
17
17
 
18
18
  rawset(self, "_properties", {})
@@ -25,12 +25,12 @@ function RoguePropertyTable.new(adornee, serviceBag, roguePropertyTableDefinitio
25
25
  return self
26
26
  end
27
27
 
28
- function RoguePropertyTable:SetCanInitialize(canInitialize)
28
+ function RoguePropertyTable:SetCanInitialize(canInitialize: boolean)
29
29
  assert(type(canInitialize) == "boolean", "Bad canInitialize")
30
30
 
31
31
  RogueProperty.SetCanInitialize(self, canInitialize)
32
32
 
33
- for _, property in pairs(self:GetRogueProperties()) do
33
+ for _, property in self:GetRogueProperties() do
34
34
  property:SetCanInitialize(canInitialize)
35
35
  end
36
36
 
@@ -44,7 +44,7 @@ function RoguePropertyTable:ObserveContainerBrio()
44
44
  return self._definition:ObserveContainerBrio(self._adornee, self:CanInitialize())
45
45
  end
46
46
 
47
- function RoguePropertyTable:GetContainer()
47
+ function RoguePropertyTable:GetContainer(): Instance
48
48
  local cached = rawget(self, "_containerCache")
49
49
  if cached and cached:IsDescendantOf(self._adornee) then
50
50
  return cached
@@ -60,7 +60,7 @@ function RoguePropertyTable:SetBaseValue(newBaseValue)
60
60
 
61
61
  local arrayData = {}
62
62
 
63
- for propertyName, value in pairs(newBaseValue) do
63
+ for propertyName, value in newBaseValue do
64
64
  if type(propertyName) == "string" then
65
65
  local rogueProperty = self:GetRogueProperty(propertyName)
66
66
  if not rogueProperty then
@@ -88,7 +88,7 @@ function RoguePropertyTable:SetValue(newValue)
88
88
 
89
89
  local arrayData = {}
90
90
 
91
- for propertyName, value in pairs(newValue) do
91
+ for propertyName, value in newValue do
92
92
  if type(propertyName) == "string" then
93
93
  local rogueProperty = self:GetRogueProperty(propertyName)
94
94
  if not rogueProperty then
@@ -185,7 +185,7 @@ function RoguePropertyTable:_observeDictionary()
185
185
  return Rx.combineLatest(toObserve)
186
186
  end
187
187
 
188
- function RoguePropertyTable:GetRogueProperty(name)
188
+ function RoguePropertyTable:GetRogueProperty(name: string)
189
189
  assert(type(name) == "string", "Bad name")
190
190
 
191
191
  -- Caching these things doesn't do a whole lot, but saves on table allocation.
@@ -10,11 +10,12 @@ local require = require(script.Parent.loader).load(script)
10
10
  local RunService = game:GetService("RunService")
11
11
 
12
12
  local Maid = require("Maid")
13
+ local _ServiceBag = require("ServiceBag")
13
14
 
14
15
  local RoguePropertyService = {}
15
16
  RoguePropertyService.ServiceName = "RoguePropertyService"
16
17
 
17
- function RoguePropertyService:Init(serviceBag)
18
+ function RoguePropertyService:Init(serviceBag: _ServiceBag.ServiceBag)
18
19
  assert(not self._serviceBag, "Already initialized")
19
20
  self._serviceBag = assert(serviceBag, "No serviceBag")
20
21
 
@@ -30,7 +31,7 @@ function RoguePropertyService:Init(serviceBag)
30
31
  self._serviceBag:GetService(require("RogueSetter"))
31
32
  end
32
33
 
33
- function RoguePropertyService:CanInitializeProperties()
34
+ function RoguePropertyService:CanInitializeProperties(): boolean
34
35
  return RunService:IsServer()
35
36
  end
36
37