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 obj_pos = obj_ref:get_pos()
|
||||
local props = obj_ref:get_properties()
|
||||
local parent = obj_ref:get_attach()
|
||||
if props and obj_pos and not parent then
|
||||
if not (props and obj_pos and not obj_ref:get_attach()) then
|
||||
return false
|
||||
end
|
||||
|
||||
local collisionbox = props.collisionbox
|
||||
local physical = props.physical
|
||||
local is_player = obj_ref:is_player()
|
||||
local luaentity = obj_ref:get_luaentity()
|
||||
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_max = plate_pos.x + 7 / 16
|
||||
local plate_z_min = plate_pos.z - 7 / 16
|
||||
|
@ -50,8 +55,6 @@ local function pp_on_timer(pos)
|
|||
then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue