mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-09-27 23:00:29 +02:00
add minimum interrupt time to luacontroller to optionally remove hyper-fast signals
This commit is contained in:
parent
da57a6214a
commit
cfbbc00c5c
|
@ -316,6 +316,11 @@ if mesecon.setting("luacontroller_lightweight_interrupts", false) then
|
||||||
get_interrupt = function(pos, itbl, send_warning)
|
get_interrupt = function(pos, itbl, send_warning)
|
||||||
return (function(time, iid)
|
return (function(time, iid)
|
||||||
if type(time) ~= "number" then error("Delay must be a number") end
|
if type(time) ~= "number" then error("Delay must be a number") end
|
||||||
|
local mintime = mesecon.setting("luacontroller_minimum_interrupt", 1)
|
||||||
|
if time < mintime then
|
||||||
|
send_warning("Delay is too short (using "..mintime..")" )
|
||||||
|
time = mintime
|
||||||
|
end
|
||||||
if iid ~= nil then send_warning("Interrupt IDs are disabled on this server") end
|
if iid ~= nil then send_warning("Interrupt IDs are disabled on this server") end
|
||||||
table.insert(itbl, function() minetest.get_node_timer(pos):start(time) end)
|
table.insert(itbl, function() minetest.get_node_timer(pos):start(time) end)
|
||||||
end)
|
end)
|
||||||
|
@ -329,6 +334,11 @@ else
|
||||||
-- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y
|
-- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y
|
||||||
-- Hence the values get moved out. Should take less time than original, so totally compatible
|
-- Hence the values get moved out. Should take less time than original, so totally compatible
|
||||||
if type(time) ~= "number" then error("Delay must be a number") end
|
if type(time) ~= "number" then error("Delay must be a number") end
|
||||||
|
local mintime = mesecon.setting("luacontroller_minimum_interrupt", 1)
|
||||||
|
if time < mintime then
|
||||||
|
send_warning("Delay is too short (using "..mintime..")" )
|
||||||
|
time = mintime
|
||||||
|
end
|
||||||
table.insert(itbl, function ()
|
table.insert(itbl, function ()
|
||||||
-- Outside string metatable sandbox, can safely run this now
|
-- Outside string metatable sandbox, can safely run this now
|
||||||
local luac_id = minetest.get_meta(pos):get_int("luac_id")
|
local luac_id = minetest.get_meta(pos):get_int("luac_id")
|
||||||
|
|
|
@ -23,6 +23,7 @@ mesecon.luacontroller_string_rep_max (string:rep result length limit) int 64000
|
||||||
mesecon.luacontroller_digiline_maxlen (Digiline message size limit) int 50000 1000 1000000
|
mesecon.luacontroller_digiline_maxlen (Digiline message size limit) int 50000 1000 1000000
|
||||||
mesecon.luacontroller_maxevents (Controller execution time limit) int 10000 1000 100000
|
mesecon.luacontroller_maxevents (Controller execution time limit) int 10000 1000 100000
|
||||||
mesecon.luacontroller_memsize (Controller memory limit) int 100000 10000 1000000
|
mesecon.luacontroller_memsize (Controller memory limit) int 100000 10000 1000000
|
||||||
|
mesecon.luacontroller_minimum_interrupt (Minimum interrupt time) float 1 0.1 1000000
|
||||||
|
|
||||||
# Use node timer for interrupts (runs in active blocks only).
|
# Use node timer for interrupts (runs in active blocks only).
|
||||||
# IID is ignored and at most one interrupt may be queued if this setting is enabled.
|
# IID is ignored and at most one interrupt may be queued if this setting is enabled.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user