From f0bc18154e9dbf99cb286f19182b3333779d2fe4 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 18 Sep 2019 20:22:30 -0400 Subject: [PATCH] fix corner case Placing a "wallmounted" sign onto a streets lamp would cause a weird rotation if you're pointing downward too far. Now it enforces NESW direction according to your yaw. Also fixes bad orientation when you're really close to a post. --- api.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index ca38991..e067697 100644 --- a/api.lua +++ b/api.lua @@ -739,8 +739,18 @@ function signs_lib.after_place_node(pos, placer, itemstack, pointed_thing, locke local pdef = minetest.registered_items[pnode.name] if (def.allow_onpole ~= false) and signs_lib.check_for_pole(pos, pointed_thing) then + print("allow onpole") + print(def.paramtype2) + local newparam2 + local lookdir = minetest.yaw_to_dir(placer:get_look_horizontal()) + if def.paramtype2 == "wallmounted" then + newparam2 = minetest.dir_to_wallmounted(lookdir) + else + newparam2 = minetest.dir_to_facedir(lookdir) + end local node = minetest.get_node(pos) - minetest.swap_node(pos, {name = itemstack:get_name().."_onpole", param2 = node.param2}) + print(node.param2, newparam2) + minetest.swap_node(pos, {name = itemstack:get_name().."_onpole", param2 = newparam2}) elseif def.allow_hanging and signs_lib.check_for_ceiling(pointed_thing) then local newparam2 = minetest.dir_to_facedir(placer:get_look_dir()) local node = minetest.get_node(pos)