From 8b721c04e0cacefe7bd6402f1c00406b303a1d70 Mon Sep 17 00:00:00 2001 From: cheapie Date: Sun, 27 Apr 2025 00:41:25 -0500 Subject: Minor controller/dispatcher performance improvements --- controller.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'controller.lua') 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 -- cgit v1.2.3