@rbxts/covenant 3.3.7 → 3.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/covenant",
3
- "version": "3.3.7",
3
+ "version": "3.4.0",
4
4
  "main": "src/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
package/src/covenant.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface CovenantProps {
14
14
  predictionSend: (worldChanges: WorldChangesForPrediction) => void;
15
15
  predictionConnect: (callback: (player: Player, worldChanges: WorldChangesForPrediction) => void) => void;
16
16
  }
17
+ type ComponentSubscriber<T extends defined = defined> = (entity: Entity, state: T | undefined, previousState: T | undefined, isDeleting: boolean) => void;
17
18
  type ComponentPredictionValidator = (player: Player, entity: Entity, newState: unknown, lastState: unknown) => boolean;
18
19
  export declare class Covenant {
19
20
  private _world;
@@ -55,7 +56,7 @@ export declare class Covenant {
55
56
  private preventPostStartCall;
56
57
  private schedule;
57
58
  private worldSet;
58
- subscribeComponent<T>(component: Entity<T>, subscriber: (entity: Entity, state: T | undefined, previousState: T | undefined) => void): () => void;
59
+ subscribeComponent<T extends defined>(component: Entity<T>, subscriber: ComponentSubscriber<T>): () => void;
59
60
  private worldDelete;
60
61
  worldComponent<T extends defined>(name: string): Entity<T>;
61
62
  getComponentName(component: Entity): string;
package/src/covenant.luau CHANGED
@@ -387,7 +387,7 @@ do
387
387
  if _result ~= nil then
388
388
  -- ▼ ReadonlySet.forEach ▼
389
389
  local _callback = function(subscriber)
390
- subscriber(entity, newState, lastState)
390
+ subscriber(entity, newState, lastState, false)
391
391
  end
392
392
  for _v in _result do
393
393
  _callback(_v, _v, _result)
@@ -482,7 +482,7 @@ do
482
482
  if _result ~= nil then
483
483
  -- ▼ ReadonlySet.forEach ▼
484
484
  local _callback_1 = function(subscriber)
485
- subscriber(entity, nil, lastState)
485
+ subscriber(entity, nil, lastState, false)
486
486
  end
487
487
  for _v in _result do
488
488
  _callback_1(_v, _v, _result)