@rbxts/covenant 1.5.0 → 1.5.2
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 +6 -4
- package/src/covenant.luau +12 -7
package/package.json
CHANGED
package/src/covenant.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Entity, Id } from "@rbxts/jecs";
|
|
2
2
|
import { CovenantHooks, Discriminator } from "./hooks";
|
|
3
3
|
import { Remove, Delete } from "./stringEnums";
|
|
4
|
+
export * from "@rbxts/jecs";
|
|
4
5
|
export type WorldChangesForReplication = Map<string, Delete | Map<string, defined | Remove>>;
|
|
5
6
|
export type WorldChangesForPrediction = Map<string, Map<string, defined | Remove>>;
|
|
6
7
|
export interface CovenantProps {
|
|
7
|
-
|
|
8
|
+
requestPayloadSend: () => void;
|
|
9
|
+
requestPayloadConnect: (callback: (player: Player) => void) => void;
|
|
8
10
|
replicationSend: (player: Player, worldChanges: WorldChangesForReplication) => void;
|
|
9
11
|
replicationSendAll?: (worldChanges: WorldChangesForReplication) => void;
|
|
10
12
|
replicationConnect: (callback: (worldChanges: WorldChangesForReplication) => void) => void;
|
|
@@ -24,13 +26,14 @@ export declare class Covenant {
|
|
|
24
26
|
private started;
|
|
25
27
|
private stringifiedComponentSubscribers;
|
|
26
28
|
private stringifiedComponentValidators;
|
|
27
|
-
private
|
|
29
|
+
private requestPayloadSend;
|
|
30
|
+
private requestPayloadConnect;
|
|
28
31
|
private replicationSend;
|
|
29
32
|
private replicationConnect;
|
|
30
33
|
private replicationSendAll;
|
|
31
34
|
private predictionSend;
|
|
32
35
|
private predictionConnect;
|
|
33
|
-
constructor({
|
|
36
|
+
constructor({ requestPayloadSend, requestPayloadConnect, replicationSend, replicationConnect, replicationSendAll, predictionSend, predictionConnect, }: CovenantProps);
|
|
34
37
|
private setupPredictionClient;
|
|
35
38
|
private forEachComponentChanges;
|
|
36
39
|
private setupPredictionServer;
|
|
@@ -76,4 +79,3 @@ export declare class Covenant {
|
|
|
76
79
|
worldGet<T extends [Id] | [Id, Id] | [Id, Id, Id] | [Id, Id, Id, Id]>(entity: Entity, ...components: T): import("@rbxts/jecs").FlattenTuple<[...import("@rbxts/jecs").Nullable<import("@rbxts/jecs").InferComponents<T>>]>;
|
|
77
80
|
worldContains(entity: Entity): boolean;
|
|
78
81
|
}
|
|
79
|
-
export {};
|
package/src/covenant.luau
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
3
4
|
local _jecs = TS.import(script, TS.getModule(script, "@rbxts", "jecs").jecs)
|
|
4
5
|
local ChildOf = _jecs.ChildOf
|
|
5
6
|
local pair = _jecs.pair
|
|
@@ -15,6 +16,9 @@ local _helpers = TS.import(script, script.Parent, "helpers")
|
|
|
15
16
|
local compareMaps = _helpers.compareMaps
|
|
16
17
|
local turnSetWithIdentifierToMap = _helpers.turnSetWithIdentifierToMap
|
|
17
18
|
local EventMap = TS.import(script, script.Parent, "dataStructureWithEvents").EventMap
|
|
19
|
+
for _k, _v in TS.import(script, TS.getModule(script, "@rbxts", "jecs").jecs) or {} do
|
|
20
|
+
exports[_k] = _v
|
|
21
|
+
end
|
|
18
22
|
-- Map<Entity, Delete | Map<Component, state | Remove>>
|
|
19
23
|
-- Map<Component, Map<Entity, state | Remove>>
|
|
20
24
|
local function createWorldWithRange(minClientEntity, maxClientEntity)
|
|
@@ -40,7 +44,8 @@ do
|
|
|
40
44
|
return self:constructor(...) or self
|
|
41
45
|
end
|
|
42
46
|
function Covenant:constructor(_param)
|
|
43
|
-
local
|
|
47
|
+
local requestPayloadSend = _param.requestPayloadSend
|
|
48
|
+
local requestPayloadConnect = _param.requestPayloadConnect
|
|
44
49
|
local replicationSend = _param.replicationSend
|
|
45
50
|
local replicationConnect = _param.replicationConnect
|
|
46
51
|
local replicationSendAll = _param.replicationSendAll
|
|
@@ -57,7 +62,8 @@ do
|
|
|
57
62
|
self.started = false
|
|
58
63
|
self.stringifiedComponentSubscribers = {}
|
|
59
64
|
self.stringifiedComponentValidators = {}
|
|
60
|
-
self.
|
|
65
|
+
self.requestPayloadSend = requestPayloadSend
|
|
66
|
+
self.requestPayloadConnect = requestPayloadConnect
|
|
61
67
|
self.replicationSend = replicationSend
|
|
62
68
|
self.replicationConnect = replicationConnect
|
|
63
69
|
self.replicationSendAll = replicationSendAll
|
|
@@ -187,7 +193,7 @@ do
|
|
|
187
193
|
end, math.huge)
|
|
188
194
|
end
|
|
189
195
|
function Covenant:setupReplicationPayload()
|
|
190
|
-
|
|
196
|
+
self.requestPayloadConnect(function(player)
|
|
191
197
|
task.defer(function()
|
|
192
198
|
if not player:IsDescendantOf(Players) then
|
|
193
199
|
return nil
|
|
@@ -316,7 +322,7 @@ do
|
|
|
316
322
|
-- ▲ ReadonlyArray.forEach ▲
|
|
317
323
|
end)
|
|
318
324
|
end)
|
|
319
|
-
self.
|
|
325
|
+
self.requestPayloadSend()
|
|
320
326
|
end
|
|
321
327
|
function Covenant:preventPostStartCall()
|
|
322
328
|
local _arg0 = not self.started
|
|
@@ -863,6 +869,5 @@ do
|
|
|
863
869
|
return self._world:contains(entity)
|
|
864
870
|
end
|
|
865
871
|
end
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}
|
|
872
|
+
exports.Covenant = Covenant
|
|
873
|
+
return exports
|