Added callbacks for systems

This commit is contained in:
Justin van der Leij 2018-07-30 13:32:48 +02:00
parent 30a3b38fe1
commit 940217af40
2 changed files with 29 additions and 5 deletions

View file

@ -42,11 +42,6 @@ function System.new(...)
return systemProto
end
--- Default initialization function.
-- @param ... Varags
function System:init(...)
end
--- Builds a Pool for the System.
-- @param baseFilter The 'raw' Filter
-- @return A new Pool
@ -140,6 +135,11 @@ function System:__has(e)
return self.__all[e] and true
end
--- Default callback for system initialization.
-- @param ... Varags
function System:init(...)
end
--- Default callback for adding an Entity.
-- @param e The Entity that was added
function System:entityAdded(e)
@ -162,6 +162,21 @@ end
function System:entityRemovedFrom(e, pool)
end
-- Default callback for when the System is added to an Instance.
-- @param instance The Instance the System was added to
function System:addedTo(instance)
end
-- Default callback for when a System's callback is enabled.
-- @param callbackName The name of the callback that was enabled
function System:enabledCallback(callbackName)
end
-- Default callback for when a System's callback is disabled.
-- @param callbackName The name of the callback that was disabled
function System:disabledCallback(callbackName)
end
return setmetatable(System, {
__call = function(_, ...) return System.new(...) end,
})