separate logic and init/input ticks; make inputs stack
This commit is contained in:
@@ -294,27 +294,13 @@ function Simulation.queuecallback(sim, gate, ...)
|
||||
sim.callbacks[gate.objref] = {...}
|
||||
end
|
||||
|
||||
function Simulation.tick(sim)
|
||||
function Simulation.ticklogic(sim)
|
||||
for k, group in ipairs(sim.groupqueue) do
|
||||
Group.update(group)
|
||||
group.in_queue = false
|
||||
end
|
||||
sim.groupqueue = {}
|
||||
|
||||
if sim.initqueue ~= nil then
|
||||
for k, gate in pairs(sim.initqueue) do
|
||||
Gate.init(gate)
|
||||
end
|
||||
sim.initqueue = nil
|
||||
end
|
||||
|
||||
if sim.inputqueue ~= nil then
|
||||
for gate, argv in pairs(sim.inputqueue) do
|
||||
Gate.input(gate, argv)
|
||||
end
|
||||
sim.inputqueue = nil
|
||||
end
|
||||
|
||||
if sim.tickqueue[sim.current_tick] ~= nil then
|
||||
for i, gate in pairs(sim.tickqueue[sim.current_tick]) do
|
||||
Simulation.queuegate(sim, gate)
|
||||
@@ -331,6 +317,24 @@ function Simulation.tick(sim)
|
||||
sim.current_tick = sim.current_tick + 1
|
||||
end
|
||||
|
||||
function Simulation.tickinit(sim)
|
||||
if sim.initqueue ~= nil then
|
||||
for k, gate in pairs(sim.initqueue) do
|
||||
Gate.init(gate)
|
||||
end
|
||||
sim.initqueue = nil
|
||||
end
|
||||
end
|
||||
|
||||
function Simulation.tickinput(sim)
|
||||
if sim.inputqueue ~= nil then
|
||||
for gate, argv in pairs(sim.inputqueue) do
|
||||
Gate.input(gate, argv)
|
||||
end
|
||||
sim.inputqueue = nil
|
||||
end
|
||||
end
|
||||
|
||||
function Simulation.sendfxupdate(sim)
|
||||
for k, group in pairs(sim.groupfxqueue) do
|
||||
if group.state ~= group.fxstate then
|
||||
|
||||
Reference in New Issue
Block a user