@rbxts/covenant 3.1.1 → 3.2.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.1.1",
3
+ "version": "3.2.0",
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,23 @@ 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
+ self:worldSet(entity, c, nil)
494
482
  end
495
483
  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
484
+ for _k, _v in _exp do
485
+ _callback(_v, _k - 1, _exp)
504
486
  end
505
- for _v in processed do
506
- _callback(_v, _v, processed)
487
+ -- ReadonlyArray.forEach
488
+ self._world:delete(entity)
489
+ if RunService:IsServer() then
490
+ local _worldChangesForReplication = self.worldChangesForReplication
491
+ local _arg0 = tostring(entity)
492
+ _worldChangesForReplication[_arg0] = Delete
507
493
  end
508
- -- ▲ ReadonlySet.forEach ▲
509
494
  end
510
495
  function Covenant:worldComponent()
511
496
  self:preventPostStartCall()
@@ -513,6 +498,8 @@ do
513
498
  local _undefinedStringifiedComponents = self.undefinedStringifiedComponents
514
499
  local _arg0 = tostring(c)
515
500
  _undefinedStringifiedComponents[_arg0] = true
501
+ local _exp = self.components
502
+ table.insert(_exp, c)
516
503
  if RunService:IsStudio() and self.logging then
517
504
  print(`{(debug.info(2, "sl"))}:{c}`)
518
505
  end