1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 09:09:30 +00:00

Fix error if onRemove in subsystem call :remove again

This commit is contained in:
Étienne Fildadut 2021-04-13 01:55:29 +02:00
parent f607058753
commit 366bb63ed5

View file

@ -243,11 +243,14 @@ let system_mt = {
-- Returns all removed entities.
-- Complexity: O(1) per system.
remove = :(e, ...)
if e ~= nil and @_previous[e] then
if e ~= nil then
if @_previous[e] then
-- remove from subsystems
for _, s in ipairs(@systems) do
s:remove(e)
end
end
if @_previous[e] then -- recheck in case it was removed already from a subsystem onRemove callback
-- remove from linked list
let prev = @_previous[e]
if prev == true then
@ -266,6 +269,7 @@ let system_mt = {
@entityCount -= 1
@onRemove(e[@name])
end
end
if ... then
return e, @remove(...)
else