mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2024-11-17 04:44:23 +00:00
Don't update a System without an update field in the System.
This commit is contained in:
parent
94fc3ac453
commit
fd49633d17
10
tiny.lua
10
tiny.lua
@ -1,6 +1,6 @@
|
|||||||
--- @module tiny-ecs
|
--- @module tiny-ecs
|
||||||
-- @author Calvin Rose
|
-- @author Calvin Rose
|
||||||
local tiny = { _VERSION = "1.0-2" }
|
local tiny = { _VERSION = "1.0-3" }
|
||||||
|
|
||||||
-- Local versions of standard lua functions
|
-- Local versions of standard lua functions
|
||||||
local tinsert = table.insert
|
local tinsert = table.insert
|
||||||
@ -457,13 +457,17 @@ function tiny.update(world, dt)
|
|||||||
tiny_manageEntities(world)
|
tiny_manageEntities(world)
|
||||||
|
|
||||||
local systems = world.systems
|
local systems = world.systems
|
||||||
local systemData
|
local systemData, system, update
|
||||||
|
|
||||||
-- Iterate through Systems IN ORDER
|
-- Iterate through Systems IN ORDER
|
||||||
for i = 1, #systems do
|
for i = 1, #systems do
|
||||||
systemData = systems[i]
|
systemData = systems[i]
|
||||||
if systemData.active then
|
if systemData.active then
|
||||||
systemData.system:update(systemData.entities, dt)
|
system = systemData.system
|
||||||
|
update = system.update
|
||||||
|
if update then
|
||||||
|
update(system, systemData.entities, dt)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user