From 4ff88e211d7850ef29687f7d4d2d8ae9de86ee4f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 16:02:55 +0200 Subject: [PATCH] Fix sign text entity position problems --- mods/ITEMS/mcl_signs/init.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index b9eda0d86a..b8838f2873 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -259,10 +259,10 @@ minetest.register_node("mcl_signs:wall_sign", { local under = pointed_thing.under -- Use pointed node's on_rightclick function first, if present - local node = minetest.get_node(under) + local node_under = minetest.get_node(under) if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then - return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack end end @@ -281,7 +281,6 @@ minetest.register_node("mcl_signs:wall_sign", { local fdir = minetest.dir_to_facedir(dir) local sign_info - local place_pos local nodeitem = ItemStack(itemstack) -- Ceiling if wdir == 0 then @@ -290,7 +289,6 @@ minetest.register_node("mcl_signs:wall_sign", { -- Floor elseif wdir == 1 then -- Standing sign - place_pos = above -- Determine the sign rotation based on player's yaw local yaw = math.pi*2 - placer:get_look_horizontal() @@ -325,7 +323,6 @@ minetest.register_node("mcl_signs:wall_sign", { -- Side else -- Wall sign - place_pos = above local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) if not success then return itemstack @@ -333,6 +330,14 @@ minetest.register_node("mcl_signs:wall_sign", { sign_info = signtext_info_wall[fdir + 1] end + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end + local text_entity = minetest.add_entity({ x = place_pos.x + sign_info.delta.x, y = place_pos.y + sign_info.delta.y,