apply suggestions from @Desour
This commit is contained in:
parent
0bd8932721
commit
860a367da7
|
@ -574,15 +574,13 @@ end
|
||||||
|
|
||||||
-- Returns success (boolean), errmsg (string)
|
-- Returns success (boolean), errmsg (string)
|
||||||
-- run (as opposed to run_inner) is responsible for setting up meta according to this output
|
-- run (as opposed to run_inner) is responsible for setting up meta according to this output
|
||||||
local function run_inner(pos, code, event)
|
local function run_inner(pos, meta, event)
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
-- Note: These return success, presumably to avoid changing LC ID.
|
-- Note: These return success, presumably to avoid changing LC ID.
|
||||||
if overheat(pos) then return true, "" end
|
if overheat(pos) then return true, "" end
|
||||||
if ignore_event(event, meta) then return true, "" end
|
if ignore_event(event, meta) then return true, "" end
|
||||||
|
|
||||||
-- Load code & mem from meta
|
-- Load code & mem from meta
|
||||||
local mem = load_memory(meta)
|
local mem = load_memory(meta)
|
||||||
code = meta:get_string("code")
|
|
||||||
|
|
||||||
-- 'Last warning' label.
|
-- 'Last warning' label.
|
||||||
local warning = ""
|
local warning = ""
|
||||||
|
@ -595,7 +593,7 @@ local function run_inner(pos, code, event)
|
||||||
local env = create_environment(pos, mem, event, itbl, send_warning)
|
local env = create_environment(pos, mem, event, itbl, send_warning)
|
||||||
|
|
||||||
-- Create the sandbox and execute code
|
-- Create the sandbox and execute code
|
||||||
local f, msg = create_sandbox(code, env)
|
local f, msg = create_sandbox(meta:get_string("code"), env)
|
||||||
if not f then return false, msg end
|
if not f then return false, msg end
|
||||||
-- Start string true sandboxing
|
-- Start string true sandboxing
|
||||||
local onetruestring = getmetatable("")
|
local onetruestring = getmetatable("")
|
||||||
|
@ -651,7 +649,7 @@ end
|
||||||
local function run(pos, event)
|
local function run(pos, event)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local code = meta:get_string("code")
|
local code = meta:get_string("code")
|
||||||
local ok, errmsg = run_inner(pos, code, event)
|
local ok, errmsg = run_inner(pos, meta, event)
|
||||||
if not ok then
|
if not ok then
|
||||||
reset_meta(pos, code, errmsg)
|
reset_meta(pos, code, errmsg)
|
||||||
else
|
else
|
||||||
|
|
|
@ -460,10 +460,10 @@ local piston_up_down_get_stopper = function (node, dir, stack, stackid)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function piston_get_stopper(node, dir, stack, stackid)
|
local function piston_get_stopper(node, _, stack, stackid)
|
||||||
local pistonspec = get_pistonspec(node.name, "onname")
|
local pistonspec = get_pistonspec(node.name, "onname")
|
||||||
local inverted_dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
|
local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
|
||||||
local pusherpos = vector.add(stack[stackid].pos, inverted_dir)
|
local pusherpos = vector.add(stack[stackid].pos, dir)
|
||||||
local pushernode = minetest.get_node(pusherpos)
|
local pushernode = minetest.get_node(pusherpos)
|
||||||
if pistonspec.pusher == pushernode.name then
|
if pistonspec.pusher == pushernode.name then
|
||||||
for _, s in ipairs(stack) do
|
for _, s in ipairs(stack) do
|
||||||
|
|
Loading…
Reference in New Issue