mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 12:24:11 -04:00
Fixed some things regarding deregistering
This commit is contained in:
parent
fae3c4a427
commit
0d5f05fa64
1 changed files with 5 additions and 3 deletions
|
@ -39,24 +39,26 @@ function Instance:removeEntity(e)
|
|||
end
|
||||
end
|
||||
|
||||
function Instance:addSystem(system, eventName)
|
||||
function Instance:addSystem(system, eventName, callback)
|
||||
if not self.namedSystems[system] then
|
||||
self.systems[#self.systems + 1] = system
|
||||
self.namedSystems[system] = system
|
||||
end
|
||||
|
||||
self.eventManager:register(eventName, system)
|
||||
self.eventManager:register(eventName, system, callback)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function Instance:removeSystem(system)
|
||||
function Instance:removeSystem(system, callback)
|
||||
for index, other in ipairs(self.systems) do
|
||||
if system == other then
|
||||
table.remove(self.systems, index)
|
||||
end
|
||||
end
|
||||
|
||||
self.eventManager:deregister(eventName, system, callback)
|
||||
|
||||
self.namedSystems[system] = nil
|
||||
|
||||
return self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue