mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-09-27 23:00:29 +02:00
Flatten out contact detection code
This commit is contained in:
parent
9d276033dc
commit
85a10404c7
|
@ -21,14 +21,19 @@ local function pp_on_timer(pos)
|
||||||
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()
|
||||||
local parent = obj_ref:get_attach()
|
if not (props and obj_pos and not obj_ref:get_attach()) then
|
||||||
if props and obj_pos and not parent then
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local collisionbox = props.collisionbox
|
local collisionbox = props.collisionbox
|
||||||
local physical = props.physical
|
local physical = props.physical
|
||||||
local is_player = obj_ref:is_player()
|
local is_player = obj_ref:is_player()
|
||||||
local luaentity = obj_ref:get_luaentity()
|
local luaentity = obj_ref:get_luaentity()
|
||||||
local is_item = luaentity and luaentity.name == "__builtin:item"
|
local is_item = luaentity and luaentity.name == "__builtin:item"
|
||||||
if collisionbox and physical or is_player or is_item then
|
if not (collisionbox and physical or is_player or is_item) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local plate_x_min = plate_pos.x - 7 / 16
|
local plate_x_min = plate_pos.x - 7 / 16
|
||||||
local plate_x_max = plate_pos.x + 7 / 16
|
local plate_x_max = plate_pos.x + 7 / 16
|
||||||
local plate_z_min = plate_pos.z - 7 / 16
|
local plate_z_min = plate_pos.z - 7 / 16
|
||||||
|
@ -50,8 +55,6 @@ local function pp_on_timer(pos)
|
||||||
then
|
then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user