@rbxts/covenant 1.0.10 → 1.0.12
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/package.json +1 -1
- package/src/covenant.d.ts +3 -2
- package/src/covenant.luau +15 -6
- package/src/hooks.luau +3 -3
package/package.json
CHANGED
package/src/covenant.d.ts
CHANGED
|
@@ -36,11 +36,13 @@ export declare class Covenant {
|
|
|
36
36
|
private setupReplicationClient;
|
|
37
37
|
private setupReplication;
|
|
38
38
|
start(): void;
|
|
39
|
+
private preventPostStartCall;
|
|
39
40
|
private schedule;
|
|
40
41
|
private worldSet;
|
|
41
42
|
subscribeComponent<T>(component: Entity<T>, subscriber: (entity: Entity, state: T | undefined, previousState: T | undefined) => void): () => void;
|
|
42
43
|
private worldDelete;
|
|
43
44
|
worldComponent<T extends defined>(): Entity<T>;
|
|
45
|
+
private worldInternalComponent;
|
|
44
46
|
private checkComponentDefined;
|
|
45
47
|
private defineComponentNetworkBehavior;
|
|
46
48
|
defineComputedComponent<T extends defined>({ component, queriedComponents, recipe, replicated, predictionValidator, }: {
|
|
@@ -50,11 +52,10 @@ export declare class Covenant {
|
|
|
50
52
|
queriedComponents: Entity[][];
|
|
51
53
|
recipe: (entity: Entity, lastState: T | undefined, updateId: number, hooks: CovenantHooks) => T | undefined;
|
|
52
54
|
}): void;
|
|
53
|
-
defineManagedChildren<T extends defined>({ parentComponent,
|
|
55
|
+
defineManagedChildren<T extends defined>({ parentComponent, childIdentityComponent, getIdentifier, queriedComponents, recipe, replicated, predictionValidator, }: {
|
|
54
56
|
replicated: boolean;
|
|
55
57
|
predictionValidator: ComponentPredictionValidator | false;
|
|
56
58
|
parentComponent: Entity<ReadonlyArray<T>>;
|
|
57
|
-
parentEntityTrackerComponent: Entity<Map<Discriminator, Entity>>;
|
|
58
59
|
childIdentityComponent: Entity<T>;
|
|
59
60
|
getIdentifier: (state: T) => Discriminator;
|
|
60
61
|
queriedComponents: Entity[][];
|
package/src/covenant.luau
CHANGED
|
@@ -268,23 +268,26 @@ do
|
|
|
268
268
|
end)
|
|
269
269
|
end)
|
|
270
270
|
end
|
|
271
|
+
function Covenant:preventPostStartCall()
|
|
272
|
+
local _arg0 = not self.started
|
|
273
|
+
assert(_arg0, "Attempted to schedule system after starting")
|
|
274
|
+
end
|
|
271
275
|
function Covenant:schedule(event, system, priority)
|
|
272
276
|
if priority == nil then
|
|
273
277
|
priority = 0
|
|
274
278
|
end
|
|
275
|
-
|
|
276
|
-
assert(_arg0, "Attempted to schedule system after starting")
|
|
279
|
+
self:preventPostStartCall()
|
|
277
280
|
local systemsOfEvent = self.systems:get(event)
|
|
278
281
|
if systemsOfEvent == nil then
|
|
279
282
|
systemsOfEvent = {}
|
|
280
283
|
self.systems:set(event, systemsOfEvent)
|
|
281
284
|
end
|
|
282
285
|
local _systemsOfEvent = systemsOfEvent
|
|
283
|
-
local
|
|
286
|
+
local _arg0 = {
|
|
284
287
|
system = system,
|
|
285
288
|
priority = priority,
|
|
286
289
|
}
|
|
287
|
-
table.insert(_systemsOfEvent,
|
|
290
|
+
table.insert(_systemsOfEvent, _arg0)
|
|
288
291
|
end
|
|
289
292
|
function Covenant:worldSet(entity, component, newState, doNotReconcile)
|
|
290
293
|
if doNotReconcile == nil then
|
|
@@ -418,9 +421,16 @@ do
|
|
|
418
421
|
-- ▲ ReadonlySet.forEach ▲
|
|
419
422
|
end
|
|
420
423
|
function Covenant:worldComponent()
|
|
424
|
+
self:preventPostStartCall()
|
|
421
425
|
local c = self._world:component()
|
|
426
|
+
local _undefinedStringifiedComponents = self.undefinedStringifiedComponents
|
|
427
|
+
local _arg0 = tostring(c)
|
|
428
|
+
_undefinedStringifiedComponents[_arg0] = true
|
|
422
429
|
return c
|
|
423
430
|
end
|
|
431
|
+
function Covenant:worldInternalComponent()
|
|
432
|
+
return self._world:component()
|
|
433
|
+
end
|
|
424
434
|
function Covenant:checkComponentDefined(component)
|
|
425
435
|
local _undefinedStringifiedComponents = self.undefinedStringifiedComponents
|
|
426
436
|
local _arg0 = tostring(component)
|
|
@@ -565,7 +575,6 @@ do
|
|
|
565
575
|
end
|
|
566
576
|
function Covenant:defineManagedChildren(_param)
|
|
567
577
|
local parentComponent = _param.parentComponent
|
|
568
|
-
local parentEntityTrackerComponent = _param.parentEntityTrackerComponent
|
|
569
578
|
local childIdentityComponent = _param.childIdentityComponent
|
|
570
579
|
local getIdentifier = _param.getIdentifier
|
|
571
580
|
local queriedComponents = _param.queriedComponents
|
|
@@ -573,8 +582,8 @@ do
|
|
|
573
582
|
local replicated = _param.replicated
|
|
574
583
|
local predictionValidator = _param.predictionValidator
|
|
575
584
|
self:checkComponentDefined(parentComponent)
|
|
576
|
-
self:checkComponentDefined(parentEntityTrackerComponent)
|
|
577
585
|
self:checkComponentDefined(childIdentityComponent)
|
|
586
|
+
local parentEntityTrackerComponent = self:worldInternalComponent()
|
|
578
587
|
self:defineComponentNetworkBehavior(parentComponent, replicated, predictionValidator)
|
|
579
588
|
local queryParentComponent = self:worldQuery(parentComponent):cached()
|
|
580
589
|
local willUpdate = true
|
package/src/hooks.luau
CHANGED
|
@@ -328,10 +328,10 @@ local function createUseInterval(_param)
|
|
|
328
328
|
end
|
|
329
329
|
local _discriminator_2 = discriminator
|
|
330
330
|
local nextClock = nextClocks[_discriminator_2]
|
|
331
|
-
if nextClock
|
|
331
|
+
if nextClock > os.clock() then
|
|
332
332
|
local _discriminator_3 = discriminator
|
|
333
333
|
caches[_discriminator_3] = false
|
|
334
|
-
return
|
|
334
|
+
return false
|
|
335
335
|
else
|
|
336
336
|
local _discriminator_3 = discriminator
|
|
337
337
|
local _arg1 = os.clock() + seconds
|
|
@@ -339,7 +339,7 @@ local function createUseInterval(_param)
|
|
|
339
339
|
task.delay(seconds, indicateUpdate)
|
|
340
340
|
local _discriminator_4 = discriminator
|
|
341
341
|
caches[_discriminator_4] = true
|
|
342
|
-
return
|
|
342
|
+
return true
|
|
343
343
|
end
|
|
344
344
|
end
|
|
345
345
|
end
|