diff options
-rw-r--r-- | controller.lua | 6 | ||||
-rw-r--r-- | dispatcher.lua | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/controller.lua b/controller.lua index 0a43eff..2921f81 100644 --- a/controller.lua +++ b/controller.lua @@ -645,7 +645,9 @@ end function celevator.controller.checkiqueue(dtime) for hash,iqueue in pairs(celevator.controller.iqueue) do local pos = minetest.get_position_from_hash(hash) + local noneleft = true for iid,time in pairs(iqueue) do + noneleft = false iqueue[iid] = time-dtime if iqueue[iid] < 0 then iqueue[iid] = nil @@ -655,6 +657,10 @@ function celevator.controller.checkiqueue(dtime) celevator.controller.run(pos,event) end end + if noneleft then + celevator.controller.iqueue[hash] = nil + celevator.storage:set_string("controller_iqueue",minetest.serialize(celevator.controller.iqueue)) + end end end diff --git a/dispatcher.lua b/dispatcher.lua index a8bcf1c..02533ff 100644 --- a/dispatcher.lua +++ b/dispatcher.lua @@ -422,7 +422,9 @@ end function celevator.dispatcher.checkiqueue(dtime) for hash,iqueue in pairs(celevator.dispatcher.iqueue) do local pos = minetest.get_position_from_hash(hash) + local noneleft = true for iid,time in pairs(iqueue) do + noneleft = false iqueue[iid] = time-dtime if iqueue[iid] < 0 then iqueue[iid] = nil @@ -432,6 +434,10 @@ function celevator.dispatcher.checkiqueue(dtime) celevator.dispatcher.run(pos,event) end end + if noneleft then + celevator.dispatcher.iqueue[hash] = nil + celevator.storage:set_string("dispatcher_iqueue",minetest.serialize(celevator.dispatcher.iqueue)) + end end end |