Move obj_touching_plate_pos outside pp_on_timer

This commit is contained in:
MrRar 2023-04-23 17:01:48 -05:00
parent 15fa8765a5
commit 43e0639550
1 changed files with 43 additions and 43 deletions

View File

@ -10,14 +10,6 @@ local pp_box_on = {
fixed = { -7/16, -8/16, -7/16, 7/16, -7.5/16, 7/16 },
}
local function pp_on_timer(pos)
local node = minetest.get_node(pos)
local basename = minetest.registered_nodes[node.name].pressureplate_basename
-- This is a workaround for a strange bug that occurs when the server is started
-- For some reason the first time on_timer is called, the pos is wrong
if not basename then return end
local function obj_touching_plate_pos(obj_ref, plate_pos)
local obj_pos = obj_ref:get_pos()
local props = obj_ref:get_properties()
@ -61,6 +53,14 @@ local function pp_on_timer(pos)
return false
end
local function pp_on_timer(pos)
local node = minetest.get_node(pos)
local basename = minetest.registered_nodes[node.name].pressureplate_basename
-- This is a workaround for a strange bug that occurs when the server is started
-- For some reason the first time on_timer is called, the pos is wrong
if not basename then return end
local objs = minetest.get_objects_inside_radius(pos, 1)
local obj_touching = false
for k, obj in pairs(objs) do