mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2026-07-21 15:46:52 -06:00
Fix #22 - manage systems before setSystemIndex
This commit is contained in:
@@ -310,4 +310,14 @@ describe('tiny-ecs:', function()
|
|||||||
assert.are.same(_G, GLOBALS)
|
assert.are.same(_G, GLOBALS)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("Can set system indices", function()
|
||||||
|
local world = tiny.world()
|
||||||
|
local systemA = tiny.system()
|
||||||
|
local systemB = tiny.system()
|
||||||
|
world:addSystem(systemA)
|
||||||
|
world:addSystem(systemB)
|
||||||
|
world:setSystemIndex(systemA, 1)
|
||||||
|
assert(true)
|
||||||
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
local tiny = require('tiny')
|
||||||
|
|
||||||
|
local world = tiny.world()
|
||||||
|
local systemA = tiny.system()
|
||||||
|
local systemB = tiny.system()
|
||||||
|
world:addSystem(systemA)
|
||||||
|
world:addSystem(systemB)
|
||||||
|
world:setSystemIndex(systemA, 1)
|
||||||
@@ -821,6 +821,7 @@ end
|
|||||||
-- the order in which they Systems processed, because lower indexed Systems are
|
-- the order in which they Systems processed, because lower indexed Systems are
|
||||||
-- processed first. Returns the old system.index.
|
-- processed first. Returns the old system.index.
|
||||||
function tiny.setSystemIndex(world, system, index)
|
function tiny.setSystemIndex(world, system, index)
|
||||||
|
tiny_manageSystems(world)
|
||||||
local oldIndex = system.index
|
local oldIndex = system.index
|
||||||
local systems = world.systems
|
local systems = world.systems
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user