diff options
author | Jeija <jeija@mesecons.net> | 2014-01-11 08:57:21 +0100 |
---|---|---|
committer | Jeija <jeija@mesecons.net> | 2014-01-11 08:57:21 +0100 |
commit | 93fb489bdb8c13989c398b37be3135004f7b0bbc (patch) | |
tree | 87f0b822d2a0772d0162d99019b1e0f0e34de442 | |
parent | 2d004b19eaaac21b4a82fa4ba6736e5e7090041a (diff) |
Fix the bugs spotted by Novatux - thanks for spotting them
-rw-r--r-- | mesecons/actionqueue.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mesecons/actionqueue.lua b/mesecons/actionqueue.lua index 8eae192..9d31426 100644 --- a/mesecons/actionqueue.lua +++ b/mesecons/actionqueue.lua @@ -9,11 +9,12 @@ end function mesecon.queue:add_action(pos, func, params, time, overwritecheck) -- Create Action Table: time = time or 0 -- time <= 0 --> execute, time > 0 --> wait time until execution - action = { pos=pos, + overwritecheck = overwritecheck or {} + action = { pos=mesecon:tablecopy(pos), func=func, params=mesecon:tablecopy(params), time=time, - owcheck=overwritecheck} + owcheck=mesecon:tablecopy(overwritecheck)} --print(dump(action)) -- if not using the queue, (MESECONS_GLOBALSTEP off), just execute the function an we're done @@ -25,7 +26,7 @@ function mesecon.queue:add_action(pos, func, params, time, overwritecheck) -- Otherwise, add the action to the queue if overwritecheck then -- check if old action has to be overwritten / removed: for i, ac in ipairs(mesecon.queue.actions) do - if(mesecon:cmpPos(pos, action.pos) + if(mesecon:cmpPos(pos, ac.pos) and mesecon:cmpAny(overwritecheck, ac.owcheck)) then table.remove(mesecon.queue.actions, i) break |