mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-28 16:27:28 +01:00
Fix odd behaviour when using interrupts in the luacontroller
This commit is contained in:
parent
10ea3c971b
commit
eeed4f148d
@ -162,9 +162,10 @@ end
|
|||||||
local getinterrupt = function(pos)
|
local getinterrupt = function(pos)
|
||||||
local interrupt = function (time, iid) -- iid = interrupt id
|
local interrupt = function (time, iid) -- iid = interrupt id
|
||||||
if type(time) ~= "number" then return end
|
if type(time) ~= "number" then return end
|
||||||
|
local iid = iid or math.random()
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
local interrupts = minetest.deserialize(meta:get_string("lc_interrupts")) or {}
|
local interrupts = minetest.deserialize(meta:get_string("lc_interrupts")) or {}
|
||||||
table.insert (interrupts, iid or 0)
|
table.insert (interrupts, iid)
|
||||||
meta:set_string("lc_interrupts", minetest.serialize(interrupts))
|
meta:set_string("lc_interrupts", minetest.serialize(interrupts))
|
||||||
minetest.after(time, interrupt, {pos=pos, iid = iid})
|
minetest.after(time, interrupt, {pos=pos, iid = iid})
|
||||||
end
|
end
|
||||||
@ -297,6 +298,7 @@ local reset_meta = function(pos, code, errmsg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local reset = function (pos)
|
local reset = function (pos)
|
||||||
|
minetest.env:get_meta(pos):set_string("lc_interrupts", "")
|
||||||
action(pos, {a=false, b=false, c=false, d=false}, true)
|
action(pos, {a=false, b=false, c=false, d=false}, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user