mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2026-07-21 23:56:50 -06:00
Fix bug with deactivating Systems. Add test.
This commit is contained in:
@@ -138,6 +138,20 @@ describe('tiny-ecs:', function()
|
||||
assert.equals(timePassed, 0)
|
||||
assert.equals(entity1.xform.x, entityTemplate1.xform.x)
|
||||
end)
|
||||
|
||||
it("Disable and Enable Systems", function()
|
||||
world:setSystemActive(moveSystem, false)
|
||||
world:setSystemActive(oneTimeSystem, false)
|
||||
world:update(1)
|
||||
assert.equals(timePassed, 0)
|
||||
assert.equals(entity1.xform.x, entityTemplate1.xform.x)
|
||||
world:setSystemActive(moveSystem, true)
|
||||
world:setSystemActive(oneTimeSystem, true)
|
||||
world:update(1)
|
||||
assert.equals(timePassed, 1)
|
||||
assert.are_not.equal(entity1.xform.x, entityTemplate1.xform.x)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
@@ -389,7 +389,7 @@ end
|
||||
-- @param system A System in the World activate/deactivate
|
||||
-- @param active Boolean new state of the System
|
||||
function tiny.setSystemActive(world, system, active)
|
||||
world.activeSystem[system] = active and true or nil
|
||||
world.activeSystems[system] = active and true or nil
|
||||
end
|
||||
|
||||
return tiny
|
||||
|
||||
Reference in New Issue
Block a user