@rbxts/covenant 1.3.0 → 1.3.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.3.0",
3
+ "version": "1.3.1",
4
4
  "main": "src/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
package/src/covenant.d.ts CHANGED
@@ -64,7 +64,7 @@ export declare class Covenant {
64
64
  defineStaticEntity<T extends defined>({ identityComponent, recipe, replicated, }: {
65
65
  replicated: boolean;
66
66
  identityComponent: Entity<T>;
67
- recipe: (updateId: number, hooks: CovenantHooks) => T[];
67
+ recipe: () => T[];
68
68
  }): void;
69
69
  private worldEntity;
70
70
  worldQuery<T extends Id[]>(...components: T): import("@rbxts/jecs").Query<import("@rbxts/jecs").InferComponents<T>>;
package/src/covenant.luau CHANGED
@@ -776,37 +776,16 @@ do
776
776
  local replicated = _param.replicated
777
777
  self:checkComponentDefined(identityComponent)
778
778
  self:defineComponentNetworkBehavior(identityComponent, replicated, false)
779
- local willUpdate = true
780
- local function indicateUpdate()
781
- willUpdate = true
779
+ local states = recipe()
780
+ -- ReadonlyArray.forEach ▼
781
+ local _callback = function(state)
782
+ local entity = self:worldEntity()
783
+ self:worldSet(entity, identityComponent, state)
782
784
  end
783
- local hooks = createHooks({
784
- indicateUpdate = indicateUpdate,
785
- subscribeComponent = function(component, subscriber)
786
- self:subscribeComponent(component, subscriber)
787
- end,
788
- })
789
- local lastUpdateId = 0
790
- local updater = function()
791
- lastUpdateId += 1
792
- local states = recipe(lastUpdateId, hooks)
793
- -- ▼ ReadonlyArray.forEach ▼
794
- local _callback = function(state)
795
- local entity = self:worldEntity()
796
- self:worldSet(entity, identityComponent, state)
797
- end
798
- for _k, _v in states do
799
- _callback(_v, _k - 1, states)
800
- end
801
- -- ▲ ReadonlyArray.forEach ▲
785
+ for _k, _v in states do
786
+ _callback(_v, _k - 1, states)
802
787
  end
803
- self:schedule(RunService.Heartbeat, function()
804
- if not willUpdate then
805
- return nil
806
- end
807
- willUpdate = false
808
- updater()
809
- end)
788
+ -- ▲ ReadonlyArray.forEach
810
789
  end
811
790
  function Covenant:worldEntity()
812
791
  return self._world:entity()