mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-07-05 00:50:24 +02:00
Move obj_touching_plate_pos outside pp_on_timer
This commit is contained in:
@ -10,15 +10,7 @@ local pp_box_on = {
|
|||||||
fixed = { -7/16, -8/16, -7/16, 7/16, -7.5/16, 7/16 },
|
fixed = { -7/16, -8/16, -7/16, 7/16, -7.5/16, 7/16 },
|
||||||
}
|
}
|
||||||
|
|
||||||
local function pp_on_timer(pos)
|
local function obj_touching_plate_pos(obj_ref, plate_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 obj_pos = obj_ref:get_pos()
|
||||||
local props = obj_ref:get_properties()
|
local props = obj_ref:get_properties()
|
||||||
if not (props and obj_pos and not obj_ref:get_attach()) then
|
if not (props and obj_pos and not obj_ref:get_attach()) then
|
||||||
@ -59,7 +51,15 @@ local function pp_on_timer(pos)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
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 objs = minetest.get_objects_inside_radius(pos, 1)
|
||||||
local obj_touching = false
|
local obj_touching = false
|
||||||
|
Reference in New Issue
Block a user