mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 15:23:48 +01:00
Minetest: Boxes: Fix walkable/pointable check
Bug reported by Gregor Parzefall in https://github.com/appgurueu/modlib/pull/8#issuecomment-1295793962
This commit is contained in:
parent
2d056e72ae
commit
e6c5860cb9
@ -11,11 +11,13 @@ local function get_boxes(box_or_boxes)
|
|||||||
return type(box_or_boxes[1]) == "number" and {box_or_boxes} or box_or_boxes
|
return type(box_or_boxes[1]) == "number" and {box_or_boxes} or box_or_boxes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local has_boxes_prop = {collision_box = "walkable", selection_box = "pointable"}
|
||||||
|
|
||||||
--> list of collisionboxes in Minetest format
|
--> list of collisionboxes in Minetest format
|
||||||
local function get_node_boxes(pos, type)
|
local function get_node_boxes(pos, type)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local node_def = minetest.registered_nodes[node.name]
|
local node_def = minetest.registered_nodes[node.name]
|
||||||
if (not node_def) or node_def.walkable == false then
|
if not node_def or node_def[has_boxes_prop[type]] == false then
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
local boxes = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}}
|
local boxes = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}}
|
||||||
|
Loading…
Reference in New Issue
Block a user