@quenty/rogue-properties 11.25.2-canary.63ba0e0.0 → 11.25.2-canary.ff3c47a.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 +1 -3
- package/package.json +16 -16
- package/src/Shared/Definition/RoguePropertyTableDefinition.lua +16 -12
- package/src/Shared/Implementation/RogueProperty.lua +43 -80
- package/src/Shared/Implementation/RoguePropertyArrayHelper.lua +0 -3
- package/src/Shared/Implementation/RoguePropertyTable.lua +4 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,14 +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
|
-
## [11.25.2-canary.
|
|
6
|
+
## [11.25.2-canary.ff3c47a.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rogue-properties@11.25.1...@quenty/rogue-properties@11.25.2-canary.ff3c47a.0) (2025-09-26)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
11
|
* Fix caching performance of the rogue system when multiple things want to observe state ([1a067f7](https://github.com/Quenty/NevermoreEngine/commit/1a067f7dec837a2eb4db399e46bf06566824c9a3))
|
|
12
|
-
* Fix parenting and application on client ([ff2f125](https://github.com/Quenty/NevermoreEngine/commit/ff2f1254f45289537444190bc0596f9f519c592e))
|
|
13
|
-
* Fix stuff ([63ba0e0](https://github.com/Quenty/NevermoreEngine/commit/63ba0e0c4b5c8bdaeb452f0b3d742b7b8bc8a7ab))
|
|
14
12
|
* Style stuff ([ff3c47a](https://github.com/Quenty/NevermoreEngine/commit/ff3c47af4e5b23f912aa09a0784849751d5736e1))
|
|
15
13
|
|
|
16
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/rogue-properties",
|
|
3
|
-
"version": "11.25.2-canary.
|
|
3
|
+
"version": "11.25.2-canary.ff3c47a.0",
|
|
4
4
|
"description": "Roguelike properties which can be modified by external provides",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -24,35 +24,35 @@
|
|
|
24
24
|
"Quenty"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@quenty/adorneedata": "7.20.1-canary.
|
|
28
|
-
"@quenty/attributeutils": "14.19.1-canary.
|
|
27
|
+
"@quenty/adorneedata": "7.20.1-canary.ff3c47a.0",
|
|
28
|
+
"@quenty/attributeutils": "14.19.1-canary.ff3c47a.0",
|
|
29
29
|
"@quenty/baseobject": "10.9.0",
|
|
30
|
-
"@quenty/binder": "14.22.1-canary.
|
|
31
|
-
"@quenty/brio": "14.19.1-canary.
|
|
30
|
+
"@quenty/binder": "14.22.1-canary.ff3c47a.0",
|
|
31
|
+
"@quenty/brio": "14.19.1-canary.ff3c47a.0",
|
|
32
32
|
"@quenty/defaultvalueutils": "1.2.2",
|
|
33
33
|
"@quenty/ducktype": "5.9.0",
|
|
34
|
-
"@quenty/instanceutils": "13.19.1-canary.
|
|
34
|
+
"@quenty/instanceutils": "13.19.1-canary.ff3c47a.0",
|
|
35
35
|
"@quenty/jsonutils": "10.12.0",
|
|
36
|
-
"@quenty/linkutils": "13.19.1-canary.
|
|
36
|
+
"@quenty/linkutils": "13.19.1-canary.ff3c47a.0",
|
|
37
37
|
"@quenty/loader": "10.9.0",
|
|
38
38
|
"@quenty/maid": "3.5.0",
|
|
39
|
-
"@quenty/observablecollection": "12.22.2-canary.
|
|
40
|
-
"@quenty/remoting": "12.20.1-canary.
|
|
41
|
-
"@quenty/rx": "13.19.1-canary.
|
|
42
|
-
"@quenty/rxbinderutils": "14.22.1-canary.
|
|
43
|
-
"@quenty/rxsignal": "7.19.1-canary.
|
|
39
|
+
"@quenty/observablecollection": "12.22.2-canary.ff3c47a.0",
|
|
40
|
+
"@quenty/remoting": "12.20.1-canary.ff3c47a.0",
|
|
41
|
+
"@quenty/rx": "13.19.1-canary.ff3c47a.0",
|
|
42
|
+
"@quenty/rxbinderutils": "14.22.1-canary.ff3c47a.0",
|
|
43
|
+
"@quenty/rxsignal": "7.19.1-canary.ff3c47a.0",
|
|
44
44
|
"@quenty/servicebag": "11.13.1",
|
|
45
45
|
"@quenty/signal": "7.11.1",
|
|
46
46
|
"@quenty/spring": "10.9.0",
|
|
47
47
|
"@quenty/string": "3.3.3",
|
|
48
48
|
"@quenty/table": "3.8.0",
|
|
49
|
-
"@quenty/tie": "10.22.1-canary.
|
|
50
|
-
"@quenty/valuebaseutils": "13.19.1-canary.
|
|
51
|
-
"@quenty/valueobject": "13.19.1-canary.
|
|
49
|
+
"@quenty/tie": "10.22.1-canary.ff3c47a.0",
|
|
50
|
+
"@quenty/valuebaseutils": "13.19.1-canary.ff3c47a.0",
|
|
51
|
+
"@quenty/valueobject": "13.19.1-canary.ff3c47a.0",
|
|
52
52
|
"@quentystudios/t": "^3.0.0"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "ff3c47af4e5b23f912aa09a0784849751d5736e1"
|
|
58
58
|
}
|
|
@@ -232,37 +232,41 @@ RoguePropertyTableDefinition.GetPropertyTable = RoguePropertyTableDefinition.Get
|
|
|
232
232
|
|
|
233
233
|
@return Observable<Brio<Folder>>
|
|
234
234
|
]=]
|
|
235
|
-
function RoguePropertyTableDefinition:ObserveContainerBrio(
|
|
236
|
-
|
|
235
|
+
function RoguePropertyTableDefinition:ObserveContainerBrio(
|
|
236
|
+
serviceBag: ServiceBag.ServiceBag,
|
|
237
|
+
adornee: Instance,
|
|
238
|
+
canInitialize: boolean
|
|
239
|
+
)
|
|
237
240
|
assert(typeof(adornee) == "Instance", "Bad adornee")
|
|
241
|
+
assert(type(canInitialize) == "boolean", "Bad canInitialize")
|
|
238
242
|
|
|
239
243
|
local found = self:Get(serviceBag, adornee)
|
|
240
244
|
|
|
241
245
|
-- TODO: caninitialize is broken
|
|
242
246
|
|
|
243
|
-
return found:ObserveContainerBrio()
|
|
247
|
+
return found:ObserveContainerBrio(canInitialize)
|
|
244
248
|
end
|
|
245
249
|
|
|
246
250
|
--[=[
|
|
247
251
|
Gets the current container for the given adornee.
|
|
252
|
+
@param adornee Instance
|
|
253
|
+
@param canInitialize boolean
|
|
248
254
|
@return Folder?
|
|
249
255
|
]=]
|
|
250
|
-
function RoguePropertyTableDefinition:GetContainer(
|
|
251
|
-
|
|
256
|
+
function RoguePropertyTableDefinition:GetContainer(
|
|
257
|
+
serviceBag: ServiceBag.ServiceBag,
|
|
258
|
+
adornee: Instance,
|
|
259
|
+
canInitialize: boolean
|
|
260
|
+
): Folder?
|
|
252
261
|
assert(typeof(adornee) == "Instance", "Bad adornee")
|
|
262
|
+
assert(type(canInitialize) == "boolean", "Bad canInitialize")
|
|
253
263
|
|
|
254
264
|
local found = self:Get(serviceBag, adornee)
|
|
255
265
|
|
|
256
266
|
return found:GetContainer()
|
|
257
267
|
end
|
|
258
268
|
|
|
259
|
-
function RoguePropertyTableDefinition:
|
|
260
|
-
assert(typeof(parent) == "Instance", "Bad parent")
|
|
261
|
-
|
|
262
|
-
return parent:FindFirstChild(self:GetName())
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
function RoguePropertyTableDefinition:GetOrCreateInstance(parent): Folder
|
|
269
|
+
function RoguePropertyTableDefinition:GetOrCreateInstance(parent)
|
|
266
270
|
assert(typeof(parent) == "Instance", "Bad parent")
|
|
267
271
|
|
|
268
272
|
local existing = parent:FindFirstChild(self:GetName())
|
|
@@ -261,15 +261,6 @@ function RogueProperty:_getModifierParentContainerList()
|
|
|
261
261
|
return containerList
|
|
262
262
|
end
|
|
263
263
|
|
|
264
|
-
function RogueProperty:PromiseBaseValue()
|
|
265
|
-
return Rx.toPromise(self:_observeBaseValueBrio():Pipe({
|
|
266
|
-
RxBrioUtils.flattenToValueAndNil,
|
|
267
|
-
Rx.where(function(value)
|
|
268
|
-
return value ~= nil
|
|
269
|
-
end),
|
|
270
|
-
}))
|
|
271
|
-
end
|
|
272
|
-
|
|
273
264
|
function RogueProperty:_observeModifierContainersBrio()
|
|
274
265
|
local name = self:_getLocalModifierParentName()
|
|
275
266
|
|
|
@@ -299,30 +290,13 @@ function RogueProperty:SetValue(value)
|
|
|
299
290
|
|
|
300
291
|
local baseValue = self:GetBaseValueObject(RoguePropertyBaseValueTypes.ANY)
|
|
301
292
|
if not baseValue then
|
|
302
|
-
|
|
293
|
+
warn(
|
|
303
294
|
string.format(
|
|
304
295
|
"[RogueProperty.SetValue] - Failed to get the baseValue for %q on %q",
|
|
305
296
|
self._definition:GetFullName(),
|
|
306
297
|
self._adornee:GetFullName()
|
|
307
298
|
)
|
|
308
299
|
)
|
|
309
|
-
|
|
310
|
-
local warnTask = task.delay(5, function()
|
|
311
|
-
warn(warningText)
|
|
312
|
-
end)
|
|
313
|
-
|
|
314
|
-
self:PromiseBaseValue():Then(function(thisBaseValue)
|
|
315
|
-
local current = value
|
|
316
|
-
|
|
317
|
-
local modifiers = self:GetRogueModifiers()
|
|
318
|
-
for i = #modifiers, 1, -1 do
|
|
319
|
-
current = modifiers[i]:GetInvertedVersion(current, value)
|
|
320
|
-
end
|
|
321
|
-
|
|
322
|
-
thisBaseValue.Value = self:_encodeValue(current)
|
|
323
|
-
task.cancel(warnTask)
|
|
324
|
-
end)
|
|
325
|
-
|
|
326
300
|
return
|
|
327
301
|
end
|
|
328
302
|
|
|
@@ -483,6 +457,17 @@ end
|
|
|
483
457
|
function RogueProperty:CreateMultiplier(amount: number, source)
|
|
484
458
|
assert(type(amount) == "number", "Bad amount")
|
|
485
459
|
|
|
460
|
+
local modifierParent = self:_getModifierParentContainerForNewModifier()
|
|
461
|
+
if not modifierParent then
|
|
462
|
+
warn(
|
|
463
|
+
string.format(
|
|
464
|
+
"[RogueProperty.CreateMultiplier] - Failed to get the modifierParent for %q on %q",
|
|
465
|
+
self._definition:GetFullName(),
|
|
466
|
+
self._adornee:GetFullName()
|
|
467
|
+
)
|
|
468
|
+
)
|
|
469
|
+
end
|
|
470
|
+
|
|
486
471
|
local className = ValueBaseUtils.getClassNameFromType(typeof(amount))
|
|
487
472
|
if not className then
|
|
488
473
|
error(string.format("[RogueProperty.CreateMultiplier] - Can't set to type %q", typeof(amount)))
|
|
@@ -499,7 +484,7 @@ function RogueProperty:CreateMultiplier(amount: number, source)
|
|
|
499
484
|
|
|
500
485
|
RogueMultiplier:Tag(multiplier)
|
|
501
486
|
|
|
502
|
-
|
|
487
|
+
multiplier.Parent = modifierParent
|
|
503
488
|
|
|
504
489
|
return multiplier
|
|
505
490
|
end
|
|
@@ -507,6 +492,18 @@ end
|
|
|
507
492
|
function RogueProperty:CreateAdditive(amount: number, source)
|
|
508
493
|
assert(type(amount) == "number", "Bad amount")
|
|
509
494
|
|
|
495
|
+
local modifierParent = self:_getModifierParentContainerForNewModifier()
|
|
496
|
+
if not modifierParent then
|
|
497
|
+
warn(
|
|
498
|
+
string.format(
|
|
499
|
+
"[RogueProperty.CreateAdditive] - Failed to get the modifierParent for %q on %q",
|
|
500
|
+
self._definition:GetFullName(),
|
|
501
|
+
self._adornee:GetFullName()
|
|
502
|
+
)
|
|
503
|
+
)
|
|
504
|
+
return nil
|
|
505
|
+
end
|
|
506
|
+
|
|
510
507
|
local className = ValueBaseUtils.getClassNameFromType(typeof(amount))
|
|
511
508
|
if not className then
|
|
512
509
|
error(string.format("[RogueProperty.CreateAdditive] - Can't set to type %q", typeof(amount)))
|
|
@@ -523,7 +520,7 @@ function RogueProperty:CreateAdditive(amount: number, source)
|
|
|
523
520
|
|
|
524
521
|
RogueAdditive:Tag(additive)
|
|
525
522
|
|
|
526
|
-
|
|
523
|
+
additive.Parent = modifierParent
|
|
527
524
|
|
|
528
525
|
return additive
|
|
529
526
|
end
|
|
@@ -531,14 +528,11 @@ end
|
|
|
531
528
|
function RogueProperty:GetNamedAdditive(name, source)
|
|
532
529
|
local modifierParent = self:_getModifierParentContainerForNewModifier()
|
|
533
530
|
if not modifierParent then
|
|
534
|
-
-- TODO: Handle this parenting scenario appropriately
|
|
535
531
|
warn(
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
self._adornee:GetFullName()
|
|
541
|
-
)
|
|
532
|
+
string.format(
|
|
533
|
+
"[RogueProperty.GetNamedAdditive] - Failed to get the modifierParent for %q on %q",
|
|
534
|
+
self._definition:GetFullName(),
|
|
535
|
+
self._adornee:GetFullName()
|
|
542
536
|
)
|
|
543
537
|
)
|
|
544
538
|
return nil
|
|
@@ -557,6 +551,18 @@ function RogueProperty:GetNamedAdditive(name, source)
|
|
|
557
551
|
end
|
|
558
552
|
|
|
559
553
|
function RogueProperty:CreateSetter(value, source)
|
|
554
|
+
local modifierParent = self:_getModifierParentContainerForNewModifier()
|
|
555
|
+
if not modifierParent then
|
|
556
|
+
warn(
|
|
557
|
+
string.format(
|
|
558
|
+
"[RogueProperty.CreateSetter] - Failed to get the modifierParent for %q on %q",
|
|
559
|
+
self._definition:GetFullName(),
|
|
560
|
+
self._adornee:GetFullName()
|
|
561
|
+
)
|
|
562
|
+
)
|
|
563
|
+
return nil
|
|
564
|
+
end
|
|
565
|
+
|
|
560
566
|
local className = ValueBaseUtils.getClassNameFromType(typeof(value))
|
|
561
567
|
if not className then
|
|
562
568
|
error(string.format("[RogueProperty.CreateSetter] - Can't set to type %q", typeof(value)))
|
|
@@ -573,54 +579,11 @@ function RogueProperty:CreateSetter(value, source)
|
|
|
573
579
|
|
|
574
580
|
RogueSetter:Tag(setter)
|
|
575
581
|
|
|
576
|
-
|
|
582
|
+
setter.Parent = modifierParent
|
|
577
583
|
|
|
578
584
|
return setter
|
|
579
585
|
end
|
|
580
586
|
|
|
581
|
-
function RogueProperty:_parentModifier(modifier: Instance)
|
|
582
|
-
local modifierParent = self:_getModifierParentContainerForNewModifier()
|
|
583
|
-
if modifierParent then
|
|
584
|
-
modifier.Parent = modifierParent
|
|
585
|
-
|
|
586
|
-
return
|
|
587
|
-
end
|
|
588
|
-
|
|
589
|
-
local maid = Maid.new()
|
|
590
|
-
|
|
591
|
-
local warningText = debug.traceback(
|
|
592
|
-
string.format(
|
|
593
|
-
"[RogueProperty._parentModifier] - Failed to get the modifierParent for %q on %q",
|
|
594
|
-
self._definition:GetFullName(),
|
|
595
|
-
self._adornee:GetFullName()
|
|
596
|
-
)
|
|
597
|
-
)
|
|
598
|
-
|
|
599
|
-
maid._warning = task.delay(5, function()
|
|
600
|
-
warn(warningText)
|
|
601
|
-
end)
|
|
602
|
-
|
|
603
|
-
maid:GivePromise(self:PromiseBaseValue()):Then(function()
|
|
604
|
-
local newParent = self:_getModifierParentContainerForNewModifier()
|
|
605
|
-
if not newParent then
|
|
606
|
-
warn(
|
|
607
|
-
"[RogueProperty:_parentModifier] - Failed to retrieve modifier parent after load, will never modify value"
|
|
608
|
-
)
|
|
609
|
-
|
|
610
|
-
return
|
|
611
|
-
end
|
|
612
|
-
|
|
613
|
-
maid._warning = nil
|
|
614
|
-
modifier.Parent = newParent
|
|
615
|
-
end)
|
|
616
|
-
|
|
617
|
-
maid:GiveTask(modifier.Destroying:Connect(function()
|
|
618
|
-
maid:DoCleaning()
|
|
619
|
-
end))
|
|
620
|
-
|
|
621
|
-
return
|
|
622
|
-
end
|
|
623
|
-
|
|
624
587
|
function RogueProperty:__index(index)
|
|
625
588
|
if RogueProperty[index] then
|
|
626
589
|
return RogueProperty[index]
|
|
@@ -149,10 +149,7 @@ function RoguePropertyArrayHelper:SetArrayData(arrayData)
|
|
|
149
149
|
|
|
150
150
|
for index, definition in definitions do
|
|
151
151
|
if available[index] and available[index]:GetDefinition():GetValueType() == definition:GetValueType() then
|
|
152
|
-
-- TODO: Replication is cursed here, and won't be consistent between client vs. server
|
|
153
|
-
available[index]:SetCanInitialize(true)
|
|
154
152
|
available[index]:SetValue(definition:GetDefaultValue())
|
|
155
|
-
available[index]:SetCanInitialize(false)
|
|
156
153
|
else
|
|
157
154
|
-- Cleanup this old one and setup a new one
|
|
158
155
|
if available[index] then
|
|
@@ -54,10 +54,7 @@ function RoguePropertyTable:ObserveContainerBrio()
|
|
|
54
54
|
local parentDefinition = self._definition:GetParentPropertyDefinition()
|
|
55
55
|
if parentDefinition then
|
|
56
56
|
local parentTable = parentDefinition:Get(self._serviceBag, self._adornee)
|
|
57
|
-
|
|
58
|
-
if self:CanInitialize() then
|
|
59
|
-
parentTable:GetContainer()
|
|
60
|
-
end
|
|
57
|
+
parentTable:GetContainer()
|
|
61
58
|
|
|
62
59
|
cache = parentTable:ObserveContainerBrio():Pipe({
|
|
63
60
|
RxBrioUtils.switchMapBrio(function(parent)
|
|
@@ -76,7 +73,7 @@ function RoguePropertyTable:ObserveContainerBrio()
|
|
|
76
73
|
return cache
|
|
77
74
|
end
|
|
78
75
|
|
|
79
|
-
function RoguePropertyTable:GetContainer(): Instance
|
|
76
|
+
function RoguePropertyTable:GetContainer(): Instance
|
|
80
77
|
local cached = rawget(self, "_containerCache")
|
|
81
78
|
if cached then
|
|
82
79
|
if cached:IsDescendantOf(self._adornee) then
|
|
@@ -95,16 +92,8 @@ function RoguePropertyTable:GetContainer(): Instance?
|
|
|
95
92
|
parent = self._adornee
|
|
96
93
|
end
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
local container
|
|
103
|
-
if self:CanInitialize() then
|
|
104
|
-
container = self._definition:GetOrCreateInstance(parent)
|
|
105
|
-
else
|
|
106
|
-
container = self._definition:FindInstance(parent)
|
|
107
|
-
end
|
|
95
|
+
local container = self._definition:GetOrCreateInstance(parent, self:CanInitialize())
|
|
96
|
+
container:AddTag("RoguePropertyTable")
|
|
108
97
|
|
|
109
98
|
rawset(self, "_containerCache", container)
|
|
110
99
|
return container
|