@rbxts/covenant 1.0.16 → 1.0.18
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 +1 -1
- package/src/covenant.luau +57 -57
package/package.json
CHANGED
package/src/covenant.luau
CHANGED
|
@@ -471,7 +471,6 @@ do
|
|
|
471
471
|
local function indicateUpdate()
|
|
472
472
|
willUpdate = true
|
|
473
473
|
end
|
|
474
|
-
self:subscribeComponent(component, indicateUpdate)
|
|
475
474
|
local hooks = createHooks({
|
|
476
475
|
indicateUpdate = indicateUpdate,
|
|
477
476
|
subscribeComponent = function(component, subscriber)
|
|
@@ -591,7 +590,6 @@ do
|
|
|
591
590
|
local function indicateUpdate()
|
|
592
591
|
willUpdate = true
|
|
593
592
|
end
|
|
594
|
-
self:subscribeComponent(parentComponent, indicateUpdate)
|
|
595
593
|
local hooks = createHooks({
|
|
596
594
|
indicateUpdate = indicateUpdate,
|
|
597
595
|
subscribeComponent = function(component, subscriber)
|
|
@@ -650,6 +648,63 @@ do
|
|
|
650
648
|
end
|
|
651
649
|
-- ▲ ReadonlyArray.forEach ▲
|
|
652
650
|
local lastUpdateId = 0
|
|
651
|
+
self:subscribeComponent(parentComponent, function(entity, newState, lastState)
|
|
652
|
+
local lastStateMap = turnArrayWithIdentifierToMap(lastState or {}, getIdentifier)
|
|
653
|
+
local newStateMap = turnArrayWithIdentifierToMap(newState or {}, getIdentifier)
|
|
654
|
+
local entityTracker = self:worldGet(entity, parentEntityTrackerComponent)
|
|
655
|
+
if entityTracker == nil then
|
|
656
|
+
entityTracker = {}
|
|
657
|
+
self:worldSet(entity, parentEntityTrackerComponent, entityTracker)
|
|
658
|
+
end
|
|
659
|
+
local _binding = compareMaps(lastStateMap, newStateMap)
|
|
660
|
+
local entriesChanged = _binding.entriesChanged
|
|
661
|
+
local entriesAdded = _binding.entriesAdded
|
|
662
|
+
local keysRemoved = _binding.keysRemoved
|
|
663
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
664
|
+
local _callback_4 = function(_param_1)
|
|
665
|
+
local key = _param_1.key
|
|
666
|
+
local value = _param_1.value
|
|
667
|
+
local childEntity = self:worldEntity()
|
|
668
|
+
entityTracker[key] = childEntity
|
|
669
|
+
self:worldSet(childEntity, childIdentityComponent, value)
|
|
670
|
+
self._world:add(childEntity, pair(ChildOf, entity))
|
|
671
|
+
end
|
|
672
|
+
for _k, _v in entriesAdded do
|
|
673
|
+
_callback_4(_v, _k - 1, entriesAdded)
|
|
674
|
+
end
|
|
675
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
676
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
677
|
+
local _callback_5 = function(_param_1)
|
|
678
|
+
local key = _param_1.key
|
|
679
|
+
local value = _param_1.value
|
|
680
|
+
local childEntity = entityTracker[key]
|
|
681
|
+
assert(childEntity ~= 0 and childEntity == childEntity and childEntity)
|
|
682
|
+
local _arg0 = self:worldContains(childEntity)
|
|
683
|
+
assert(_arg0)
|
|
684
|
+
self:worldSet(childEntity, childIdentityComponent, value)
|
|
685
|
+
end
|
|
686
|
+
for _k, _v in entriesChanged do
|
|
687
|
+
_callback_5(_v, _k - 1, entriesChanged)
|
|
688
|
+
end
|
|
689
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
690
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
691
|
+
local _callback_6 = function(key)
|
|
692
|
+
local _entityTracker = entityTracker
|
|
693
|
+
local _key = key
|
|
694
|
+
local childEntity = _entityTracker[_key]
|
|
695
|
+
assert(childEntity ~= 0 and childEntity == childEntity and childEntity)
|
|
696
|
+
local _arg0 = self:worldContains(childEntity)
|
|
697
|
+
assert(_arg0)
|
|
698
|
+
self:worldDelete(childEntity)
|
|
699
|
+
local _entityTracker_1 = entityTracker
|
|
700
|
+
local _key_1 = key
|
|
701
|
+
_entityTracker_1[_key_1] = nil
|
|
702
|
+
end
|
|
703
|
+
for _k, _v in keysRemoved do
|
|
704
|
+
_callback_6(_v, _k - 1, keysRemoved)
|
|
705
|
+
end
|
|
706
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
707
|
+
end)
|
|
653
708
|
local updater = function()
|
|
654
709
|
lastUpdateId += 1
|
|
655
710
|
local updateId = lastUpdateId
|
|
@@ -668,64 +723,9 @@ do
|
|
|
668
723
|
end
|
|
669
724
|
handledStringifiedEntities[stringifiedEntity] = true
|
|
670
725
|
unhandledStringifiedEntities[stringifiedEntity] = nil
|
|
671
|
-
local entityTracker = self:worldGet(entity, parentEntityTrackerComponent)
|
|
672
|
-
if entityTracker == nil then
|
|
673
|
-
entityTracker = {}
|
|
674
|
-
self:worldSet(entity, parentEntityTrackerComponent, entityTracker)
|
|
675
|
-
end
|
|
676
726
|
local lastState = self:worldGet(entity, parentComponent) or {}
|
|
677
727
|
local newState = recipe(entity, lastState, updateId, hooks)
|
|
678
728
|
self:worldSet(entity, parentComponent, newState)
|
|
679
|
-
local lastStateMap = turnArrayWithIdentifierToMap(lastState, getIdentifier)
|
|
680
|
-
local newStateMap = turnArrayWithIdentifierToMap(newState, getIdentifier)
|
|
681
|
-
local _binding = compareMaps(lastStateMap, newStateMap)
|
|
682
|
-
local entriesChanged = _binding.entriesChanged
|
|
683
|
-
local entriesAdded = _binding.entriesAdded
|
|
684
|
-
local keysRemoved = _binding.keysRemoved
|
|
685
|
-
-- ▼ ReadonlyArray.forEach ▼
|
|
686
|
-
local _callback_5 = function(_param_1)
|
|
687
|
-
local key = _param_1.key
|
|
688
|
-
local value = _param_1.value
|
|
689
|
-
local childEntity = self:worldEntity()
|
|
690
|
-
entityTracker[key] = childEntity
|
|
691
|
-
self:worldSet(childEntity, childIdentityComponent, value)
|
|
692
|
-
self._world:add(childEntity, pair(ChildOf, entity))
|
|
693
|
-
end
|
|
694
|
-
for _k, _v in entriesAdded do
|
|
695
|
-
_callback_5(_v, _k - 1, entriesAdded)
|
|
696
|
-
end
|
|
697
|
-
-- ▲ ReadonlyArray.forEach ▲
|
|
698
|
-
-- ▼ ReadonlyArray.forEach ▼
|
|
699
|
-
local _callback_6 = function(_param_1)
|
|
700
|
-
local key = _param_1.key
|
|
701
|
-
local value = _param_1.value
|
|
702
|
-
local childEntity = entityTracker[key]
|
|
703
|
-
assert(childEntity ~= 0 and childEntity == childEntity and childEntity)
|
|
704
|
-
local _arg0 = self:worldContains(childEntity)
|
|
705
|
-
assert(_arg0)
|
|
706
|
-
self:worldSet(childEntity, childIdentityComponent, value)
|
|
707
|
-
end
|
|
708
|
-
for _k, _v in entriesChanged do
|
|
709
|
-
_callback_6(_v, _k - 1, entriesChanged)
|
|
710
|
-
end
|
|
711
|
-
-- ▲ ReadonlyArray.forEach ▲
|
|
712
|
-
-- ▼ ReadonlyArray.forEach ▼
|
|
713
|
-
local _callback_7 = function(key)
|
|
714
|
-
local _entityTracker = entityTracker
|
|
715
|
-
local _key = key
|
|
716
|
-
local childEntity = _entityTracker[_key]
|
|
717
|
-
assert(childEntity ~= 0 and childEntity == childEntity and childEntity)
|
|
718
|
-
local _arg0 = self:worldContains(childEntity)
|
|
719
|
-
assert(_arg0)
|
|
720
|
-
self:worldDelete(childEntity)
|
|
721
|
-
local _entityTracker_1 = entityTracker
|
|
722
|
-
local _key_1 = key
|
|
723
|
-
_entityTracker_1[_key_1] = nil
|
|
724
|
-
end
|
|
725
|
-
for _k, _v in keysRemoved do
|
|
726
|
-
_callback_7(_v, _k - 1, keysRemoved)
|
|
727
|
-
end
|
|
728
|
-
-- ▲ ReadonlyArray.forEach ▲
|
|
729
729
|
end
|
|
730
730
|
end
|
|
731
731
|
for _k, _v in queries do
|