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:
parent
f607058753
commit
366bb63ed5
1 changed files with 24 additions and 20 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue