mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-07-05 09:00:22 +02:00
Move obj_touching_plate_pos outside pp_on_timer
This commit is contained in:
@ -10,14 +10,6 @@ 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 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 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()
|
||||||
@ -61,6 +53,14 @@ local function pp_on_timer(pos)
|
|||||||
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
|
||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
|
Reference in New Issue
Block a user