From 8a142501277542e958a36eb770ef99b85b0eb0f8 Mon Sep 17 00:00:00 2001 From: Oblomov Date: Fri, 18 Dec 2020 17:59:57 +0100 Subject: [PATCH] Fix stairs placement over oddly-shaped nodes (#166) --- CHANGELOG.md | 4 ++++ stairsplus/common.lua | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af7f67a..11f38fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- [Fixed stairs placement over oddly-shaped nodes.](https://github.com/minetest-mods/moreblocks/pull/166) + ## [2.1.0] - 2020-12-14 ### Added diff --git a/stairsplus/common.lua b/stairsplus/common.lua index 15e8652..182e55e 100644 --- a/stairsplus/common.lua +++ b/stairsplus/common.lua @@ -51,7 +51,10 @@ stairsplus.rotate_node_aux = function(itemstack, placer, pointed_thing) -- and in general for sneak placement local face_pos = minetest.pointed_thing_to_face_pos(placer, pointed_thing) local face_off = vector.subtract(face_pos, under) - local wallmounted = minetest.dir_to_wallmounted(face_off) + + -- we cannot trust face_off to tell us the correct directionif the + -- under node has a non-standard shape, so use the distance between under and above + local wallmounted = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.above, under)) if same_cat and not aux then p2 = under_node.param2