@quenty/conditions 10.20.0-canary.544.de8fcee.0 → 10.20.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 +20 -1
- package/package.json +10 -10
- package/src/Shared/AdorneeConditionUtils.lua +80 -65
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
|
-
|
|
6
|
+
## [10.20.1-canary.545.2374fb2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/conditions@10.20.0...@quenty/conditions@10.20.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
|
+
# [10.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/conditions@10.19.2...@quenty/conditions@10.20.0) (2025-04-02)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @quenty/conditions
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [10.19.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/conditions@10.19.1...@quenty/conditions@10.19.2) (2025-03-31)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @quenty/conditions
|
|
9
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/conditions",
|
|
3
|
-
"version": "10.20.
|
|
3
|
+
"version": "10.20.1-canary.545.2374fb2.0",
|
|
4
4
|
"description": "Adornee based conditional system that is sufficiently generic to script gameplay.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@quenty/attributeutils": "14.17.
|
|
27
|
-
"@quenty/brio": "14.17.
|
|
28
|
-
"@quenty/instanceutils": "13.17.
|
|
29
|
-
"@quenty/loader": "10.8.0",
|
|
30
|
-
"@quenty/maid": "3.4.0",
|
|
31
|
-
"@quenty/rx": "13.17.
|
|
32
|
-
"@quenty/statestack": "14.18.
|
|
33
|
-
"@quenty/tie": "10.20.
|
|
26
|
+
"@quenty/attributeutils": "14.17.1-canary.545.2374fb2.0",
|
|
27
|
+
"@quenty/brio": "14.17.1-canary.545.2374fb2.0",
|
|
28
|
+
"@quenty/instanceutils": "13.17.1-canary.545.2374fb2.0",
|
|
29
|
+
"@quenty/loader": "10.8.1-canary.545.2374fb2.0",
|
|
30
|
+
"@quenty/maid": "3.4.1-canary.545.2374fb2.0",
|
|
31
|
+
"@quenty/rx": "13.17.1-canary.545.2374fb2.0",
|
|
32
|
+
"@quenty/statestack": "14.18.1-canary.545.2374fb2.0",
|
|
33
|
+
"@quenty/tie": "10.20.1-canary.545.2374fb2.0"
|
|
34
34
|
},
|
|
35
35
|
"contributors": [
|
|
36
36
|
"Quenty"
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "2374fb2b043cfbe0e9b507b3316eec46a4e353a0"
|
|
42
42
|
}
|
|
@@ -90,11 +90,15 @@ end
|
|
|
90
90
|
@param cancelToken CancelToken?
|
|
91
91
|
@return Promise<boolean>
|
|
92
92
|
]=]
|
|
93
|
-
function AdorneeConditionUtils.promiseQueryConditionsMet(
|
|
93
|
+
function AdorneeConditionUtils.promiseQueryConditionsMet(
|
|
94
|
+
conditionObj: BindableFunction,
|
|
95
|
+
adornee: Instance,
|
|
96
|
+
cancelToken: any?
|
|
97
|
+
)
|
|
94
98
|
assert(typeof(conditionObj) == "Instance" and conditionObj:IsA("BindableFunction"), "Bad condition")
|
|
95
99
|
assert(typeof(adornee) == "Instance", "Bad adornee")
|
|
96
100
|
|
|
97
|
-
return Rx.toPromise(AdorneeConditionUtils.observeConditionsMet(conditionObj, adornee, cancelToken)
|
|
101
|
+
return Rx.toPromise(AdorneeConditionUtils.observeConditionsMet(conditionObj, adornee), cancelToken)
|
|
98
102
|
end
|
|
99
103
|
|
|
100
104
|
--[=[
|
|
@@ -143,13 +147,15 @@ function AdorneeConditionUtils.createRequiredProperty(propertyName: string, requ
|
|
|
143
147
|
return RxInstanceUtils.observeProperty(adornee, propertyName):Pipe({
|
|
144
148
|
Rx.map(function(value)
|
|
145
149
|
return value == requiredValue
|
|
146
|
-
end)
|
|
150
|
+
end),
|
|
147
151
|
})
|
|
148
152
|
end)
|
|
149
|
-
condition.Name = string.format(
|
|
153
|
+
condition.Name = string.format(
|
|
154
|
+
"RequiredProperty%s_%s_%s",
|
|
150
155
|
AdorneeConditionUtils.getConditionNamePostfix(),
|
|
151
156
|
tostring(propertyName),
|
|
152
|
-
tostring(requiredValue)
|
|
157
|
+
tostring(requiredValue)
|
|
158
|
+
)
|
|
153
159
|
|
|
154
160
|
return condition
|
|
155
161
|
end
|
|
@@ -167,14 +173,16 @@ function AdorneeConditionUtils.createRequiredAttribute(attributeName: string, at
|
|
|
167
173
|
return RxAttributeUtils.observeAttribute(adornee, attributeName):Pipe({
|
|
168
174
|
Rx.map(function(value)
|
|
169
175
|
return value == attributeValue
|
|
170
|
-
end)
|
|
176
|
+
end),
|
|
171
177
|
})
|
|
172
178
|
end)
|
|
173
179
|
|
|
174
|
-
condition.Name = string.format(
|
|
180
|
+
condition.Name = string.format(
|
|
181
|
+
"RequiredAttribute%s_%s_%s",
|
|
175
182
|
AdorneeConditionUtils.getConditionNamePostfix(),
|
|
176
183
|
tostring(attributeName),
|
|
177
|
-
tostring(attributeValue)
|
|
184
|
+
tostring(attributeValue)
|
|
185
|
+
)
|
|
178
186
|
return condition
|
|
179
187
|
end
|
|
180
188
|
|
|
@@ -190,9 +198,11 @@ function AdorneeConditionUtils.createRequiredTieInterface(tieInterfaceDefinition
|
|
|
190
198
|
return tieInterfaceDefinition:ObserveIsImplemented(adornee)
|
|
191
199
|
end)
|
|
192
200
|
|
|
193
|
-
condition.Name = string.format(
|
|
201
|
+
condition.Name = string.format(
|
|
202
|
+
"RequiredInterface%s_%s",
|
|
194
203
|
AdorneeConditionUtils.getConditionNamePostfix(),
|
|
195
|
-
tieInterfaceDefinition:GetName()
|
|
204
|
+
tieInterfaceDefinition:GetName()
|
|
205
|
+
)
|
|
196
206
|
|
|
197
207
|
return condition
|
|
198
208
|
end
|
|
@@ -207,10 +217,9 @@ function AdorneeConditionUtils.createOrConditionGroup(): BindableFunction
|
|
|
207
217
|
container = AdorneeConditionUtils.create(function(adornee: Instance)
|
|
208
218
|
assert(container, "Should not be invoking this on construction before container is assigned")
|
|
209
219
|
|
|
210
|
-
return AdorneeConditionUtils._observeConditionObservablesBrio(container, adornee)
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
})
|
|
220
|
+
return AdorneeConditionUtils._observeConditionObservablesBrio(container, adornee):Pipe({
|
|
221
|
+
AdorneeConditionUtils._mapToOr(AdorneeConditionUtils.observeValueWhenEmpty(container)),
|
|
222
|
+
})
|
|
214
223
|
end)
|
|
215
224
|
|
|
216
225
|
container.Name = string.format("OrConditionGroup%s", AdorneeConditionUtils.getConditionNamePostfix())
|
|
@@ -229,10 +238,9 @@ function AdorneeConditionUtils.createAndConditionGroup(): BindableFunction
|
|
|
229
238
|
container = AdorneeConditionUtils.create(function(adornee: Instance)
|
|
230
239
|
assert(container, "Should not be invoking this on construction before container is assigned")
|
|
231
240
|
|
|
232
|
-
return AdorneeConditionUtils._observeConditionObservablesBrio(container, adornee)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
})
|
|
241
|
+
return AdorneeConditionUtils._observeConditionObservablesBrio(container, adornee):Pipe({
|
|
242
|
+
AdorneeConditionUtils._mapToAnd(AdorneeConditionUtils.observeValueWhenEmpty(container)),
|
|
243
|
+
})
|
|
236
244
|
end)
|
|
237
245
|
|
|
238
246
|
container.Name = string.format("AndConditionGroup%s", AdorneeConditionUtils.getConditionNamePostfix())
|
|
@@ -302,7 +310,11 @@ end
|
|
|
302
310
|
function AdorneeConditionUtils.observeValueWhenEmpty(container: BindableFunction)
|
|
303
311
|
assert(typeof(container) == "Instance", "Bad container")
|
|
304
312
|
|
|
305
|
-
return RxAttributeUtils.observeAttribute(
|
|
313
|
+
return RxAttributeUtils.observeAttribute(
|
|
314
|
+
container,
|
|
315
|
+
VALUE_WHEN_EMPTY_ATTRIBUTE,
|
|
316
|
+
DEFAULT_VALUE_WHEN_EMPTY_WHEN_UNDEFINED
|
|
317
|
+
)
|
|
306
318
|
end
|
|
307
319
|
|
|
308
320
|
--[[
|
|
@@ -345,28 +357,30 @@ function AdorneeConditionUtils._mapToAnd(observeValueWhenEmpty)
|
|
|
345
357
|
topMaid:GiveTask(isDisabled.Changed:Connect(update))
|
|
346
358
|
update()
|
|
347
359
|
|
|
348
|
-
topMaid:GiveTask(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
local observable = observableBrio:GetValue()
|
|
354
|
-
local observableMaid = observableBrio:ToMaid()
|
|
355
|
-
|
|
356
|
-
activeSourceCount.Value = activeSourceCount.Value + 1
|
|
357
|
-
observableMaid:GiveTask(function()
|
|
358
|
-
activeSourceCount.Value = activeSourceCount.Value - 1
|
|
359
|
-
end)
|
|
360
|
-
|
|
361
|
-
observableMaid:GiveTask(observable:Subscribe(function(state)
|
|
362
|
-
if state then
|
|
363
|
-
observableMaid._state = nil
|
|
364
|
-
else
|
|
365
|
-
observableMaid._state = isDisabled:PushState(true)
|
|
360
|
+
topMaid:GiveTask(
|
|
361
|
+
source:Subscribe(function(observableBrio)
|
|
362
|
+
if observableBrio:IsDead() then
|
|
363
|
+
return
|
|
366
364
|
end
|
|
367
|
-
end))
|
|
368
365
|
|
|
369
|
-
|
|
366
|
+
local observable = observableBrio:GetValue()
|
|
367
|
+
local observableMaid = observableBrio:ToMaid()
|
|
368
|
+
|
|
369
|
+
activeSourceCount.Value = activeSourceCount.Value + 1
|
|
370
|
+
observableMaid:GiveTask(function()
|
|
371
|
+
activeSourceCount.Value = activeSourceCount.Value - 1
|
|
372
|
+
end)
|
|
373
|
+
|
|
374
|
+
observableMaid:GiveTask(observable:Subscribe(function(state)
|
|
375
|
+
if state then
|
|
376
|
+
observableMaid._state = nil
|
|
377
|
+
else
|
|
378
|
+
observableMaid._state = isDisabled:PushState(true)
|
|
379
|
+
end
|
|
380
|
+
end))
|
|
381
|
+
end),
|
|
382
|
+
sub:GetFailComplete()
|
|
383
|
+
)
|
|
370
384
|
|
|
371
385
|
topMaid:GiveTask(totalState.Changed:Connect(function()
|
|
372
386
|
sub:Fire(totalState.Value)
|
|
@@ -418,28 +432,30 @@ function AdorneeConditionUtils._mapToOr(observeValueWhenEmpty)
|
|
|
418
432
|
topMaid:GiveTask(isEnabled.Changed:Connect(update))
|
|
419
433
|
update()
|
|
420
434
|
|
|
421
|
-
topMaid:GiveTask(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
local observable = observableBrio:GetValue()
|
|
427
|
-
local observableMaid = observableBrio:ToMaid()
|
|
428
|
-
|
|
429
|
-
activeSourceCount.Value = activeSourceCount.Value + 1
|
|
430
|
-
observableMaid:GiveTask(function()
|
|
431
|
-
activeSourceCount.Value = activeSourceCount.Value - 1
|
|
432
|
-
end)
|
|
433
|
-
|
|
434
|
-
observableMaid:GiveTask(observable:Subscribe(function(state)
|
|
435
|
-
if state then
|
|
436
|
-
observableMaid._state = isEnabled:PushState(true)
|
|
437
|
-
else
|
|
438
|
-
observableMaid._state = nil
|
|
435
|
+
topMaid:GiveTask(
|
|
436
|
+
source:Subscribe(function(observableBrio)
|
|
437
|
+
if observableBrio:IsDead() then
|
|
438
|
+
return
|
|
439
439
|
end
|
|
440
|
-
end))
|
|
441
440
|
|
|
442
|
-
|
|
441
|
+
local observable = observableBrio:GetValue()
|
|
442
|
+
local observableMaid = observableBrio:ToMaid()
|
|
443
|
+
|
|
444
|
+
activeSourceCount.Value = activeSourceCount.Value + 1
|
|
445
|
+
observableMaid:GiveTask(function()
|
|
446
|
+
activeSourceCount.Value = activeSourceCount.Value - 1
|
|
447
|
+
end)
|
|
448
|
+
|
|
449
|
+
observableMaid:GiveTask(observable:Subscribe(function(state)
|
|
450
|
+
if state then
|
|
451
|
+
observableMaid._state = isEnabled:PushState(true)
|
|
452
|
+
else
|
|
453
|
+
observableMaid._state = nil
|
|
454
|
+
end
|
|
455
|
+
end))
|
|
456
|
+
end),
|
|
457
|
+
sub:GetFailComplete()
|
|
458
|
+
)
|
|
443
459
|
|
|
444
460
|
topMaid:GiveTask(totalState.Changed:Connect(function()
|
|
445
461
|
sub:Fire(totalState.Value)
|
|
@@ -462,12 +478,11 @@ function AdorneeConditionUtils._observeConditionObservablesBrio(parent: Instance
|
|
|
462
478
|
|
|
463
479
|
return RxInstanceUtils.observeChildrenBrio(parent, function(child)
|
|
464
480
|
return child:IsA("BindableFunction") and CollectionService:HasTag(child, AdorneeConditionUtils.getRequiredTag())
|
|
465
|
-
end)
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
});
|
|
481
|
+
end):Pipe({
|
|
482
|
+
RxBrioUtils.map(function(conditionObj)
|
|
483
|
+
return AdorneeConditionUtils._getObservableFromConditionObj(conditionObj, adornee)
|
|
484
|
+
end),
|
|
485
|
+
})
|
|
471
486
|
end
|
|
472
487
|
|
|
473
488
|
--[[
|