mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2026-07-21 23:56:50 -06:00
Fixed bug in ordering of systems.
This commit is contained in:
@@ -167,9 +167,13 @@ function tiny.add(world, ...)
|
|||||||
local args = {...}
|
local args = {...}
|
||||||
local entityStatus = world.entityStatus
|
local entityStatus = world.entityStatus
|
||||||
local systemStatus = world.systemStatus
|
local systemStatus = world.systemStatus
|
||||||
|
local systemIndices = world.systemIndices
|
||||||
|
local systemCount = world.systemCount
|
||||||
for _, obj in ipairs(args) do
|
for _, obj in ipairs(args) do
|
||||||
if getmetatable(obj) == systemMetaTable then
|
if getmetatable(obj) == systemMetaTable then
|
||||||
systemStatus[obj] = "add"
|
systemStatus[obj] = "add"
|
||||||
|
systemCount = systemCount + 1
|
||||||
|
systemIndices[obj] = systemCount
|
||||||
else -- Assume obj is an Entity
|
else -- Assume obj is an Entity
|
||||||
entityStatus[obj] = "add"
|
entityStatus[obj] = "add"
|
||||||
end
|
end
|
||||||
@@ -239,8 +243,7 @@ function tiny.manageSystems(world)
|
|||||||
if status == "add" then
|
if status == "add" then
|
||||||
local es = {}
|
local es = {}
|
||||||
systemEntities[system] = es
|
systemEntities[system] = es
|
||||||
tinsert(systems, system)
|
systems[systemIndices[system]] = system
|
||||||
systemIndices[system] = #systems
|
|
||||||
activeSystems[system] = true
|
activeSystems[system] = true
|
||||||
local filter = system.filter
|
local filter = system.filter
|
||||||
if filter then
|
if filter then
|
||||||
|
|||||||
Reference in New Issue
Block a user