@rbxts/covenant 1.4.2 → 1.5.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/covenant",
3
- "version": "1.4.2",
3
+ "version": "1.5.1",
4
4
  "main": "src/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
package/src/covenant.d.ts CHANGED
@@ -4,6 +4,8 @@ import { Remove, Delete } from "./stringEnums";
4
4
  export type WorldChangesForReplication = Map<string, Delete | Map<string, defined | Remove>>;
5
5
  export type WorldChangesForPrediction = Map<string, Map<string, defined | Remove>>;
6
6
  export interface CovenantProps {
7
+ requestPayloadSend: () => void;
8
+ requestPayloadConnect: (callback: (player: Player) => void) => void;
7
9
  replicationSend: (player: Player, worldChanges: WorldChangesForReplication) => void;
8
10
  replicationSendAll?: (worldChanges: WorldChangesForReplication) => void;
9
11
  replicationConnect: (callback: (worldChanges: WorldChangesForReplication) => void) => void;
@@ -23,12 +25,14 @@ export declare class Covenant {
23
25
  private started;
24
26
  private stringifiedComponentSubscribers;
25
27
  private stringifiedComponentValidators;
28
+ private requestPayloadSend;
29
+ private requestPayloadConnect;
26
30
  private replicationSend;
27
31
  private replicationConnect;
28
32
  private replicationSendAll;
29
33
  private predictionSend;
30
34
  private predictionConnect;
31
- constructor({ replicationSend, replicationConnect, replicationSendAll, predictionSend, predictionConnect, }: CovenantProps);
35
+ constructor({ requestPayloadSend, requestPayloadConnect, replicationSend, replicationConnect, replicationSendAll, predictionSend, predictionConnect, }: CovenantProps);
32
36
  private setupPredictionClient;
33
37
  private forEachComponentChanges;
34
38
  private setupPredictionServer;
package/src/covenant.luau CHANGED
@@ -40,6 +40,8 @@ do
40
40
  return self:constructor(...) or self
41
41
  end
42
42
  function Covenant:constructor(_param)
43
+ local requestPayloadSend = _param.requestPayloadSend
44
+ local requestPayloadConnect = _param.requestPayloadConnect
43
45
  local replicationSend = _param.replicationSend
44
46
  local replicationConnect = _param.replicationConnect
45
47
  local replicationSendAll = _param.replicationSendAll
@@ -56,6 +58,8 @@ do
56
58
  self.started = false
57
59
  self.stringifiedComponentSubscribers = {}
58
60
  self.stringifiedComponentValidators = {}
61
+ self.requestPayloadSend = requestPayloadSend
62
+ self.requestPayloadConnect = requestPayloadConnect
59
63
  self.replicationSend = replicationSend
60
64
  self.replicationConnect = replicationConnect
61
65
  self.replicationSendAll = replicationSendAll
@@ -185,7 +189,7 @@ do
185
189
  end, math.huge)
186
190
  end
187
191
  function Covenant:setupReplicationPayload()
188
- Players.PlayerAdded:Connect(function(player)
192
+ self.requestPayloadConnect(function(player)
189
193
  task.defer(function()
190
194
  if not player:IsDescendantOf(Players) then
191
195
  return nil
@@ -314,6 +318,7 @@ do
314
318
  -- ▲ ReadonlyArray.forEach ▲
315
319
  end)
316
320
  end)
321
+ self.requestPayloadSend()
317
322
  end
318
323
  function Covenant:preventPostStartCall()
319
324
  local _arg0 = not self.started