mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2024-11-17 04:44:23 +00:00
Fix #22 - manage systems before setSystemIndex
This commit is contained in:
parent
e095e10d44
commit
afd7d326d7
@ -310,4 +310,14 @@ describe('tiny-ecs:', function()
|
||||
assert.are.same(_G, GLOBALS)
|
||||
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)
|
||||
|
8
test.lua
Normal file
8
test.lua
Normal file
@ -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)
|
1
tiny.lua
1
tiny.lua
@ -821,6 +821,7 @@ end
|
||||
-- the order in which they Systems processed, because lower indexed Systems are
|
||||
-- processed first. Returns the old system.index.
|
||||
function tiny.setSystemIndex(world, system, index)
|
||||
tiny_manageSystems(world)
|
||||
local oldIndex = system.index
|
||||
local systems = world.systems
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user