This is an idea for now, but I plan to experiment around it.
The idea would be that from now on Systems have names like so:
-- System definition with a name
local RenderSystem = System("Render", {pool = {"position", "texture"}})
-- Event definition
function RenderSystem:draw ()
for _, entity in ipairs(self.pool) do
love.graphics.draw(entity.texture.image, entity.position.x, entity.position.y)
end
end
Now to emit the draw event we would usually call it like this
But this may also call other Systems that also define draw, if we only intended to call draw on the Render system we have no way to do so, with my proposal we would now call it like so:
World:emit('Render.draw', ...)
This means that now you have a way to call an event for a given System without calling events on other systems that may accidentally share the same name.
We can still target multiple systems if we don't specify the system name like so:
This makes the change backwards compatible, except for the addition of names for systems (which may also help with a debugger if we make one)
This is an idea for now, but I plan to experiment around it.
The idea would be that from now on Systems have names like so:
Now to emit the draw event we would usually call it like this
But this may also call other Systems that also define draw, if we only intended to call
drawon theRendersystem we have no way to do so, with my proposal we would now call it like so:This means that now you have a way to call an event for a given System without calling events on other systems that may accidentally share the same name.
We can still target multiple systems if we don't specify the system name like so:
This makes the change backwards compatible, except for the addition of names for systems (which may also help with a debugger if we make one)