mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 20:33:54 -04:00
Added callbacks for systems
This commit is contained in:
parent
30a3b38fe1
commit
940217af40
2 changed files with 29 additions and 5 deletions
|
@ -107,6 +107,8 @@ function Instance:addSystem(system, eventName, callback, enabled)
|
|||
if not self.systems:has(system) then
|
||||
self.systems:add(system)
|
||||
system.__instance = self
|
||||
|
||||
system:addedTo(self)
|
||||
end
|
||||
|
||||
if eventName then
|
||||
|
@ -177,7 +179,14 @@ function Instance:setSystem(system, eventName, callback, enable)
|
|||
local listener = listeners[i]
|
||||
|
||||
if listener.system == system and listener.callback == callback then
|
||||
if enable and not listener.enabled then
|
||||
system:enabledCallback(callback)
|
||||
elseif not enable and listener.enabled then
|
||||
system:disabledCallback(callback)
|
||||
end
|
||||
|
||||
listener.enabled = enable
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue