mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-09-27 23:00:29 +02:00
apply suggestions from @Desour
This commit is contained in:
parent
0bd8932721
commit
860a367da7
|
@ -574,15 +574,13 @@ end
|
|||
|
||||
-- Returns success (boolean), errmsg (string)
|
||||
-- run (as opposed to run_inner) is responsible for setting up meta according to this output
|
||||
local function run_inner(pos, code, event)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local function run_inner(pos, meta, event)
|
||||
-- Note: These return success, presumably to avoid changing LC ID.
|
||||
if overheat(pos) then return true, "" end
|
||||
if ignore_event(event, meta) then return true, "" end
|
||||
|
||||
-- Load code & mem from meta
|
||||
local mem = load_memory(meta)
|
||||
code = meta:get_string("code")
|
||||
|
||||
-- 'Last warning' label.
|
||||
local warning = ""
|
||||
|
@ -595,7 +593,7 @@ local function run_inner(pos, code, event)
|
|||
local env = create_environment(pos, mem, event, itbl, send_warning)
|
||||
|
||||
-- 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
|
||||
-- Start string true sandboxing
|
||||
local onetruestring = getmetatable("")
|
||||
|
@ -651,7 +649,7 @@ end
|
|||
local function run(pos, event)
|
||||
local meta = minetest.get_meta(pos)
|
||||
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
|
||||
reset_meta(pos, code, errmsg)
|
||||
else
|
||||
|
|
|
@ -460,10 +460,10 @@ local piston_up_down_get_stopper = function (node, dir, stack, stackid)
|
|||
return true
|
||||
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 inverted_dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
|
||||
local pusherpos = vector.add(stack[stackid].pos, inverted_dir)
|
||||
local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
|
||||
local pusherpos = vector.add(stack[stackid].pos, dir)
|
||||
local pushernode = minetest.get_node(pusherpos)
|
||||
if pistonspec.pusher == pushernode.name then
|
||||
for _, s in ipairs(stack) do
|
||||
|
|
Loading…
Reference in New Issue
Block a user