@rbxts/covenant 1.0.11 → 1.0.13
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 -3
- package/src/covenant.luau +16 -8
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,9 @@ 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>({
|
|
55
|
+
defineManagedChildren<T extends defined>({ childIdentityComponent, getIdentifier, queriedComponents, recipe, replicated, predictionValidator, }: {
|
|
54
56
|
replicated: boolean;
|
|
55
57
|
predictionValidator: ComponentPredictionValidator | false;
|
|
56
|
-
parentComponent: Entity<ReadonlyArray<T>>;
|
|
57
|
-
parentEntityTrackerComponent: Entity<Map<Discriminator, Entity>>;
|
|
58
58
|
childIdentityComponent: Entity<T>;
|
|
59
59
|
getIdentifier: (state: T) => Discriminator;
|
|
60
60
|
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)
|
|
@@ -564,17 +574,15 @@ do
|
|
|
564
574
|
end)
|
|
565
575
|
end
|
|
566
576
|
function Covenant:defineManagedChildren(_param)
|
|
567
|
-
local parentComponent = _param.parentComponent
|
|
568
|
-
local parentEntityTrackerComponent = _param.parentEntityTrackerComponent
|
|
569
577
|
local childIdentityComponent = _param.childIdentityComponent
|
|
570
578
|
local getIdentifier = _param.getIdentifier
|
|
571
579
|
local queriedComponents = _param.queriedComponents
|
|
572
580
|
local recipe = _param.recipe
|
|
573
581
|
local replicated = _param.replicated
|
|
574
582
|
local predictionValidator = _param.predictionValidator
|
|
575
|
-
self:checkComponentDefined(parentComponent)
|
|
576
|
-
self:checkComponentDefined(parentEntityTrackerComponent)
|
|
577
583
|
self:checkComponentDefined(childIdentityComponent)
|
|
584
|
+
local parentEntityTrackerComponent = self:worldInternalComponent()
|
|
585
|
+
local parentComponent = self:worldInternalComponent()
|
|
578
586
|
self:defineComponentNetworkBehavior(parentComponent, replicated, predictionValidator)
|
|
579
587
|
local queryParentComponent = self:worldQuery(parentComponent):cached()
|
|
580
588
|
local willUpdate = true
|