@rbxts/covenant 3.1.1 → 3.2.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": "3.1.1",
3
+ "version": "3.2.1",
4
4
  "main": "src/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
package/src/covenant.d.ts CHANGED
@@ -20,6 +20,7 @@ export declare class Covenant {
20
20
  private systems;
21
21
  private worldChangesForReplication;
22
22
  private worldChangesForPrediction;
23
+ private components;
23
24
  private undefinedStringifiedComponents;
24
25
  private replicatedStringifiedComponents;
25
26
  private predictedStringifiedComponents;
package/src/covenant.luau CHANGED
@@ -1,10 +1,7 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
- local _jecs = TS.import(script, TS.getModule(script, "@rbxts", "jecs").jecs)
5
- local ChildOf = _jecs.ChildOf
6
- local pair = _jecs.pair
7
- local world = _jecs.world
4
+ local world = TS.import(script, TS.getModule(script, "@rbxts", "jecs").jecs).world
8
5
  local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
9
6
  local Players = _services.Players
10
7
  local RunService = _services.RunService
@@ -44,6 +41,7 @@ do
44
41
  self.systems = EventMap.new()
45
42
  self.worldChangesForReplication = {}
46
43
  self.worldChangesForPrediction = {}
44
+ self.components = {}
47
45
  self.undefinedStringifiedComponents = {}
48
46
  self.replicatedStringifiedComponents = {}
49
47
  self.predictedStringifiedComponents = {}
@@ -476,36 +474,35 @@ do
476
474
  if not self:worldContains(entity) then
477
475
  return nil
478
476
  end
479
- local toDelete = { entity }
480
- local processed = {}
481
- while #toDelete > 0 do
482
- -- Array.pop ▼
483
- local _length = #toDelete
484
- local _result = toDelete[_length]
485
- toDelete[_length] = nil
486
- -- Array.pop
487
- local currentEntity = _result
488
- if processed[currentEntity] ~= nil or not self:worldContains(currentEntity) then
489
- continue
490
- end
491
- processed[currentEntity] = true
492
- for childEntity in self:worldQuery(pair(ChildOf, currentEntity)) do
493
- table.insert(toDelete, childEntity)
477
+ local _exp = self.components
478
+ -- ReadonlyArray.forEach
479
+ local _callback = function(c)
480
+ if self:worldHas(c) then
481
+ local _stringifiedComponentSubscribers = self.stringifiedComponentSubscribers
482
+ local _arg0 = tostring(c)
483
+ local _result = _stringifiedComponentSubscribers[_arg0]
484
+ if _result ~= nil then
485
+ -- ReadonlySet.forEach
486
+ local _callback_1 = function(subscriber)
487
+ subscriber(entity, nil, self:worldGet(entity, c))
488
+ end
489
+ for _v in _result do
490
+ _callback_1(_v, _v, _result)
491
+ end
492
+ -- ▲ ReadonlySet.forEach ▲
493
+ end
494
494
  end
495
495
  end
496
- -- ReadonlySet.forEach
497
- local _callback = function(entityToDelete)
498
- self._world:delete(entityToDelete)
499
- if RunService:IsServer() then
500
- local _worldChangesForReplication = self.worldChangesForReplication
501
- local _arg0 = tostring(entityToDelete)
502
- _worldChangesForReplication[_arg0] = Delete
503
- end
496
+ for _k, _v in _exp do
497
+ _callback(_v, _k - 1, _exp)
504
498
  end
505
- for _v in processed do
506
- _callback(_v, _v, processed)
499
+ -- ReadonlyArray.forEach
500
+ self._world:delete(entity)
501
+ if RunService:IsServer() then
502
+ local _worldChangesForReplication = self.worldChangesForReplication
503
+ local _arg0 = tostring(entity)
504
+ _worldChangesForReplication[_arg0] = Delete
507
505
  end
508
- -- ▲ ReadonlySet.forEach ▲
509
506
  end
510
507
  function Covenant:worldComponent()
511
508
  self:preventPostStartCall()
@@ -513,6 +510,8 @@ do
513
510
  local _undefinedStringifiedComponents = self.undefinedStringifiedComponents
514
511
  local _arg0 = tostring(c)
515
512
  _undefinedStringifiedComponents[_arg0] = true
513
+ local _exp = self.components
514
+ table.insert(_exp, c)
516
515
  if RunService:IsStudio() and self.logging then
517
516
  print(`{(debug.info(2, "sl"))}:{c}`)
518
517
  end