diff --git a/DEV_GROUPS.md b/DEV_GROUPS.md index 43605917..2ba7452c 100644 --- a/DEV_GROUPS.md +++ b/DEV_GROUPS.md @@ -179,7 +179,7 @@ Unlike `attached_node`, they also work if the node is not `walkable`. Use these * `door_wood`: Wooden door * `door_state`: Door segment, internal state (1 or 2) (see `rp_door` mod) * `door_position`: Door segment, position (1 = bottom, 2 = top) -* `fence`: Fence +* `fence`: Fence. Fence nodes MUST have a collisionbox height of 1.5 * `sign`: Sign * `bed`: Bed segment * `torch`: Torch diff --git a/mods/rp_mobs/task_templates.lua b/mods/rp_mobs/task_templates.lua index 858f9c8e..1c6cb535 100644 --- a/mods/rp_mobs/task_templates.lua +++ b/mods/rp_mobs/task_templates.lua @@ -568,18 +568,28 @@ local can_clear_jump = function(mob, jump_clear_height) end dir = vector.multiply(dir, 0.5) local pos_front = vector.add(pos, dir) + local node_top_walkable local h = -1 while h <= jump_clear_height do h = h + 1 local node_front = minetest.get_node(pos_front) local def_front = minetest.registered_nodes[node_front.name] - if def_front and not def_front.walkable then - break + if def_front then + if def_front.walkable then + node_top_walkable = node_front + else + break + end end pos_front.y = pos_front.y + 1 end + -- Add 0.5 to height if top node is a fence due to the overhigh collisionbox + if node_top_walkable and minetest.get_item_group(node_top_walkable.name, "fence") ~= 0 then + h = h + 0.5 + end + if h <= jump_clear_height then return true end