From d667177d6b08576faf2552a62eb96ba9ffab4fb6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 03:45:22 +0200 Subject: [PATCH 01/11] Support 16 sign rotations --- mods/ITEMS/mcl_signs/init.lua | 99 +++++++++++++++--- .../mcl_signs/textures/mcl_signs_sign.png | Bin 0 -> 571 bytes 2 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 mods/ITEMS/mcl_signs/textures/mcl_signs_sign.png diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index aa660447b7..a77a3436fb 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -27,6 +27,13 @@ local NUMBER_OF_LINES = 4 local LINE_HEIGHT = 14 local CHAR_WIDTH = 5 + +-- Helper functions +local function round(num, idp) + local mult = 10^(idp or 0) + return math.floor(num * mult + 0.5) / mult +end + local string_to_array = function(str) local tab = {} for i=1,string.len(str) do @@ -122,13 +129,13 @@ local signs = { {delta = {x = -n, y = 0, z = 0}, yaw = math.pi / 2}, } -local m = 1/32 + 1/128 +local m = 1/16 + 1/128 local signs_yard = { - {delta = {x = 0, y = 0, z = -m}, yaw = 0}, - {delta = {x = -m, y = 0, z = 0}, yaw = math.pi / -2}, - {delta = {x = 0, y = 0, z = m}, yaw = math.pi}, - {delta = {x = m, y = 0, z = 0}, yaw = math.pi / 2}, + {delta = {x = 0, y = 5/32, z = -m}, yaw = 0}, + {delta = {x = -m, y = 5/32, z = 0}, yaw = math.pi / -2}, + {delta = {x = 0, y = 5/32, z = m}, yaw = math.pi}, + {delta = {x = m, y = 5/32, z = 0}, yaw = math.pi / 2}, } local sign_groups = {handy=1,axey=1, flammable=1, deco_block=1, material_wood=1, attached_node=1} @@ -165,9 +172,10 @@ local update_sign = function(pos, fields, sender) -- if there is no entity local sign_info - if minetest.get_node(pos).name == "mcl_signs:standing_sign" then + local nn = minetest.get_node(pos).name + if nn == "mcl_signs:standing_sign" or nn == "mcl_signs:standing_sign22_5" or nn == "mcl_signs:standing_sign45" or nn == "mcl_signs:standing_sign67_5" then sign_info = signs_yard[minetest.get_node(pos).param2 + 1] - elseif minetest.get_node(pos).name == "mcl_signs:wall_sign" then + elseif nn == "mcl_signs:wall_sign" then sign_info = signs[minetest.get_node(pos).param2 + 1] end if sign_info == nil then @@ -176,6 +184,14 @@ local update_sign = function(pos, fields, sender) local text_entity = minetest.add_entity({x = pos.x + sign_info.delta.x, y = pos.y + sign_info.delta.y, z = pos.z + sign_info.delta.z}, "mcl_signs:text") + if nn == "mcl_signs:standing_sign22_5" then + sign_info.yaw = sign_info.yaw + math.pi / 8 + elseif nn == "mcl_signs:standing_sign45" then + sign_info.yaw = sign_info.yaw + 2 * (math.pi / 8) + elseif nn == "mcl_signs:standing_sign67_5" then + sign_info.yaw = sign_info.yaw + 3 * (math.pi / 8) + end + text_entity:setyaw(sign_info.yaw) end @@ -254,19 +270,49 @@ minetest.register_node("mcl_signs:wall_sign", { local sign_info local place_pos + -- Ceiling if wdir == 0 then --how would you add sign to ceiling? return itemstack + -- Floor elseif wdir == 1 then + -- Standing sign place_pos = above + + -- Determine the sign rotation based on player's yaw local stand = ItemStack(itemstack) - stand:set_name("mcl_signs:standing_sign") + local yaw = math.pi*2 - placer:get_look_horizontal() + + -- Select one of 16 possible rotations (0-15) + local rotation_level = round((yaw / (math.pi*2)) * 16) + + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end + + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + stand:set_name("mcl_signs:standing_sign") + elseif rotation_level % 4 == 1 then + stand:set_name("mcl_signs:standing_sign22_5") + elseif rotation_level % 4 == 2 then + stand:set_name("mcl_signs:standing_sign45") + elseif rotation_level % 4 == 3 then + stand:set_name("mcl_signs:standing_sign67_5") + end + fdir = math.floor(rotation_level / 4) + + -- Place the node! local _, success = minetest.item_place_node(stand, placer, pointed_thing, fdir) if not success then return itemstack end sign_info = signs_yard[fdir + 1] + -- Side else + -- Wall sign place_pos = above local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) if not success then @@ -300,19 +346,23 @@ minetest.register_node("mcl_signs:wall_sign", { _mcl_blast_resistance = 5, }) -minetest.register_node("mcl_signs:standing_sign", { + +-- Standing sign nodes. +-- 4 rotations at 0°, 22.5°, 45° and 67.5°. +-- These are 4 out of 16 possible rotations. +-- With facedir the remaining 12 rotations are constructed. + +-- 0° +local ssign = { paramtype = "light", sunlight_propagates = true, walkable = false, is_ground_content = false, paramtype2 = "facedir", - drawtype = "nodebox", - node_box = {type = "fixed", fixed = { - {-7/16, -1/16, -1/32, 7/16, 7/16, 1/32}, - {-1/16, -0.5, -1/32, 1/16, -1/16, 1/32}, - }}, + drawtype = "mesh", + mesh = "mcl_signs_sign.obj", selection_box = {type = "fixed", fixed = {-7/16, -0.5, -1/32, 7/16, 7/16, 1/32}}, - tiles = {"signs_top.png", "signs_bottom.png", "signs_side.png", "signs_side.png", "signs_back.png", "signs_front.png"}, + tiles = {"mcl_signs_sign.png"}, groups = sign_groups, drop = "mcl_signs:wall_sign", stack_max = 16, @@ -327,7 +377,24 @@ minetest.register_node("mcl_signs:standing_sign", { end, _mcl_hardness = 1, _mcl_blast_resistance = 5, -}) +} + +-- 22.5° +minetest.register_node("mcl_signs:standing_sign", ssign) +local ssign22_5 = table.copy(ssign) +ssign22_5.mesh = "mcl_signs_sign22.5.obj" + +-- 45° +minetest.register_node("mcl_signs:standing_sign22_5", ssign22_5) +local ssign45 = table.copy(ssign) +ssign45.mesh = "mcl_signs_sign45.obj" +minetest.register_node("mcl_signs:standing_sign45", ssign45) + +-- 67.5° +local ssign67 = table.copy(ssign) +ssign67.mesh = "mcl_signs_sign67.5.obj" +minetest.register_node("mcl_signs:standing_sign67_5", ssign67) + minetest.register_entity("mcl_signs:text", { collisionbox = { 0, 0, 0, 0, 0, 0 }, diff --git a/mods/ITEMS/mcl_signs/textures/mcl_signs_sign.png b/mods/ITEMS/mcl_signs/textures/mcl_signs_sign.png new file mode 100644 index 0000000000000000000000000000000000000000..e312cb52c6616382714bf98a0295443a89807d34 GIT binary patch literal 571 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3-p)I`?e@QceLrA+A6=$=f>8&D_t)Gh5{r~^p#atUG0wiBASNw5y z!&0CrVkJR-!3;n-6u|HwC^auS$CiPCagwKtV@L&K$t1>ghYdKKyEkuK>iMqzZoc#E zm&#u~y#%{r8)S|rGBRXyc1&#l6S#2)W6bnC$$6hb^VUD{joBk)UNcGm<)g`8vL1Yp z*G%(bll|-7HC2o4-LLAfi90NM!@quCqx6#L=mVSM62+e^%)73B*mc0I&`_fMZpyKl zGuH0T+f>4~w3SVKVfx!lfim9MmVc+;+jb-|oZ0#Pzz5wW@@d&`Z4Lf#y$m<)cy^P6 z*)W~0EvGKC z9BXZDZuPak@2|el4OwH${A|;M;#XT2@I7XkaF4CP=70PIC-3tN z{0zmB2Nts~F}d9Ig#9yty8J;m^#KtdJIpbJFHutLLhBuCeIo0v)eGHmz zjXe?#p}A`(*o!52`5)hr!I-huj{Vs^-Wq@1MtQGZmsvY)Zr=t*5`(9!pUXO@geCxq CT={$e literal 0 HcmV?d00001 From 273c2d3d515a80d4e0200fe9934084a04fca04cd Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 04:40:44 +0200 Subject: [PATCH 02/11] Rotate sign text entity as well --- mods/ITEMS/mcl_signs/init.lua | 47 +++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index a77a3436fb..611e62d00a 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -122,21 +122,34 @@ end local n = 7/16 - 1/128 -local signs = { +local signtext_info_wall = { {delta = {x = 0, y = 0, z = n}, yaw = 0}, {delta = {x = n, y = 0, z = 0}, yaw = math.pi / -2}, {delta = {x = 0, y = 0, z = -n}, yaw = math.pi}, {delta = {x = -n, y = 0, z = 0}, yaw = math.pi / 2}, } -local m = 1/16 + 1/128 +local signtext_info_standing = {} -local signs_yard = { - {delta = {x = 0, y = 5/32, z = -m}, yaw = 0}, - {delta = {x = -m, y = 5/32, z = 0}, yaw = math.pi / -2}, - {delta = {x = 0, y = 5/32, z = m}, yaw = math.pi}, - {delta = {x = m, y = 5/32, z = 0}, yaw = math.pi / 2}, -} +local m = -1/16 + 1/64 +for rot=0, 15 do + local yaw = math.pi*2 - (((math.pi*2) / 16) * rot) + local delta = vector.multiply(minetest.yaw_to_dir(yaw), m) + delta.y = 5/32 + table.insert(signtext_info_standing, { delta = delta, yaw = yaw }) +end + +local function get_rotation_level(facedir, nodename) + local rl = facedir * 4 + if nodename == "mcl_signs:standing_sign22_5" then + rl = rl + 1 + elseif nodename == "mcl_signs:standing_sign45" then + rl = rl + 2 + elseif nodename == "mcl_signs:standing_sign67_5" then + rl = rl + 3 + end + return rl +end local sign_groups = {handy=1,axey=1, flammable=1, deco_block=1, material_wood=1, attached_node=1} @@ -172,18 +185,20 @@ local update_sign = function(pos, fields, sender) -- if there is no entity local sign_info - local nn = minetest.get_node(pos).name + local n = minetest.get_node(pos) + local nn = n.name if nn == "mcl_signs:standing_sign" or nn == "mcl_signs:standing_sign22_5" or nn == "mcl_signs:standing_sign45" or nn == "mcl_signs:standing_sign67_5" then - sign_info = signs_yard[minetest.get_node(pos).param2 + 1] + sign_info = signtext_info_standing[get_rotation_level(n.param2, nn) + 1] elseif nn == "mcl_signs:wall_sign" then - sign_info = signs[minetest.get_node(pos).param2 + 1] + sign_info = signtext_info_wall[n.param2 + 1] end if sign_info == nil then return end - local text_entity = minetest.add_entity({x = pos.x + sign_info.delta.x, - y = pos.y + sign_info.delta.y, - z = pos.z + sign_info.delta.z}, "mcl_signs:text") + local text_entity = minetest.add_entity({ + x = pos.x + sign_info.delta.x, + y = pos.y + sign_info.delta.y, + z = pos.z + sign_info.delta.z}, "mcl_signs:text") if nn == "mcl_signs:standing_sign22_5" then sign_info.yaw = sign_info.yaw + math.pi / 8 elseif nn == "mcl_signs:standing_sign45" then @@ -309,7 +324,7 @@ minetest.register_node("mcl_signs:wall_sign", { if not success then return itemstack end - sign_info = signs_yard[fdir + 1] + sign_info = signtext_info_standing[rotation_level + 1] -- Side else -- Wall sign @@ -318,7 +333,7 @@ minetest.register_node("mcl_signs:wall_sign", { if not success then return itemstack end - sign_info = signs[fdir + 1] + sign_info = signtext_info_wall[fdir + 1] end local text = minetest.add_entity({ From 610d545d52599e7c19345b20408b0d86a57e2990 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 04:48:31 +0200 Subject: [PATCH 03/11] Move mcl_signs log to bottom --- mods/ITEMS/mcl_signs/init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index 611e62d00a..fff9380e10 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -428,10 +428,6 @@ minetest.register_entity("mcl_signs:text", { end }) -if minetest.setting_get("log_mods") then - minetest.log("action", "[mcl_signs] loaded") -end - minetest.register_craft({ type = "fuel", recipe = "mcl_signs:wall_sign", @@ -453,3 +449,8 @@ end minetest.register_alias("signs:sign_wall", "mcl_signs:wall_sign") minetest.register_alias("signs:sign_yard", "mcl_signs:standing_sign") + + +if minetest.setting_get("log_mods") then + minetest.log("action", "[mcl_signs] loaded") +end From 77cbe7bcbc68ce86b7276f416f344f96ac97e04c Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 04:50:34 +0200 Subject: [PATCH 04/11] Fix standing sign selection box --- mods/ITEMS/mcl_signs/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index fff9380e10..970a5a216b 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -376,7 +376,7 @@ local ssign = { paramtype2 = "facedir", drawtype = "mesh", mesh = "mcl_signs_sign.obj", - selection_box = {type = "fixed", fixed = {-7/16, -0.5, -1/32, 7/16, 7/16, 1/32}}, + selection_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}}, tiles = {"mcl_signs_sign.png"}, groups = sign_groups, drop = "mcl_signs:wall_sign", From 52b180824227c7be9d80714cd46d0ddc01f48795 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 05:02:29 +0200 Subject: [PATCH 05/11] Fix sign text direction on wall signs --- mods/ITEMS/mcl_signs/init.lua | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index 970a5a216b..a013aeae57 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -260,9 +260,7 @@ minetest.register_node("mcl_signs:wall_sign", { end end - local dir = {x = under.x - above.x, - y = under.y - above.y, - z = under.z - above.z} + local dir = vector.subtract(under, above) -- Only build when it's legal local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] @@ -273,13 +271,6 @@ minetest.register_node("mcl_signs:wall_sign", { local wdir = minetest.dir_to_wallmounted(dir) local placer_pos = placer:getpos() - if placer_pos then - dir = { - x = above.x - placer_pos.x, - y = above.y - placer_pos.y, - z = above.z - placer_pos.z - } - end local fdir = minetest.dir_to_facedir(dir) From aa691808d0ab720667a6ff8412f3afb1bd1143fa Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 05:27:38 +0200 Subject: [PATCH 06/11] Remove unused sign textures --- mods/ITEMS/mcl_signs/init.lua | 2 +- .../{signs_wall.png => mcl_signs_sign_wall.png} | Bin mods/ITEMS/mcl_signs/textures/signs_back.png | Bin 219 -> 0 bytes mods/ITEMS/mcl_signs/textures/signs_bottom.png | Bin 143 -> 0 bytes mods/ITEMS/mcl_signs/textures/signs_front.png | Bin 219 -> 0 bytes mods/ITEMS/mcl_signs/textures/signs_side.png | Bin 158 -> 0 bytes mods/ITEMS/mcl_signs/textures/signs_top.png | Bin 124 -> 0 bytes 7 files changed, 1 insertion(+), 1 deletion(-) rename mods/ITEMS/mcl_signs/textures/{signs_wall.png => mcl_signs_sign_wall.png} (100%) delete mode 100644 mods/ITEMS/mcl_signs/textures/signs_back.png delete mode 100644 mods/ITEMS/mcl_signs/textures/signs_bottom.png delete mode 100644 mods/ITEMS/mcl_signs/textures/signs_front.png delete mode 100644 mods/ITEMS/mcl_signs/textures/signs_side.png delete mode 100644 mods/ITEMS/mcl_signs/textures/signs_top.png diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index a013aeae57..a18a606827 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -243,7 +243,7 @@ minetest.register_node("mcl_signs:wall_sign", { paramtype2 = "wallmounted", drawtype = "nodebox", node_box = {type = "wallmounted", wall_side = {-0.499, -1/16, -7/16, -7/16, 7/16, 7/16}}, - tiles = {"signs_wall.png"}, + tiles = {"mcl_signs_sign_wall.png"}, groups = sign_groups, stack_max = 16, sounds = mcl_sounds.node_sound_wood_defaults(), diff --git a/mods/ITEMS/mcl_signs/textures/signs_wall.png b/mods/ITEMS/mcl_signs/textures/mcl_signs_sign_wall.png similarity index 100% rename from mods/ITEMS/mcl_signs/textures/signs_wall.png rename to mods/ITEMS/mcl_signs/textures/mcl_signs_sign_wall.png diff --git a/mods/ITEMS/mcl_signs/textures/signs_back.png b/mods/ITEMS/mcl_signs/textures/signs_back.png deleted file mode 100644 index a19dc2f1d51e8e38e5ad8be8e9d2247bdef434ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv3GfMV1=8NudN%rMW$_+OY5wiG zAq5d`E~Z*JAr3LFRxak+;Vvfj)-Rp{)iIU?`2{mLJiCzwTfoFL=gJKPC8tR-yXT+9sl3q`twTx|1!7BYCc L`njxgN@xNA0zX4w diff --git a/mods/ITEMS/mcl_signs/textures/signs_bottom.png b/mods/ITEMS/mcl_signs/textures/signs_bottom.png deleted file mode 100644 index d6b45e2fa5fcba26dd8b316d9b1b5022d2912ecf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 143 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Y$ZW{!9W@a@|Lkr1X3=ZE{-7; zjL8Lt*SB2^XI9G3-di9ptk7hjz@f(!!Vq|pA&~ca^C{OA&9hG%C@~hzP+(UQP-NE@ kaAfK-;az;tYxNZ_hK^qQ6xn4f7K6<7boFyt=akR{0Jire)Bpeg diff --git a/mods/ITEMS/mcl_signs/textures/signs_front.png b/mods/ITEMS/mcl_signs/textures/signs_front.png deleted file mode 100644 index e04e9b1d4cdf6dcfc2dd4788d489d13488e5fec5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv3GfMV1=8NudN%rMvuop4wPkGV z&zn>n9qDG?n-@|U<>O+m9qwXsiX-g@P#t4QkY6x^!?PP{Ku)Tsi(^OyV=@Di8>_&{ zH;?I2t3}(Q$zxv@?`%z2?1ZRSqsKyarPr>ZySk0aF9IHt^1nGRRdw x&34N4K#uyG%oSdfauqBiJo_vr3Cq6?)@FF)?U1a?$lD6C#?#f$Wt~$(695T(EldCa diff --git a/mods/ITEMS/mcl_signs/textures/signs_top.png b/mods/ITEMS/mcl_signs/textures/signs_top.png deleted file mode 100644 index f7bd16358fb2bbc81b5ba61cae417d94b16c93cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 124 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Y$ZW{!9W@a@|Lkr1X6~cE{-7; zjL8Lt*SB2^XI9G3-di9ptk7hjz@f(!!Vu`Wt4)xzK~7zBipO;aZUd<`4ELWoukL?) P3v7s|tDnm{r-UW|CIlY} From 8d10a1a7c792ed5d85f403197821c6d80e108add Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 15:11:52 +0200 Subject: [PATCH 07/11] Implement wall sign mesh --- mods/ITEMS/mcl_signs/init.lua | 53 ++++++++++++------ .../models/mcl_signs_signonwallmount.obj | 40 +++++++++++++ .../textures/mcl_signs_sign_wall.png | Bin 256 -> 0 bytes 3 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 mods/ITEMS/mcl_signs/models/mcl_signs_signonwallmount.obj delete mode 100644 mods/ITEMS/mcl_signs/textures/mcl_signs_sign_wall.png diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index a18a606827..af707b0e8a 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -110,9 +110,14 @@ local generate_line = function(s, ypos) return texture end -local generate_texture = function(lines) +local generate_texture = function(lines, signnodename) local texture = "[combine:"..SIGN_WIDTH.."x"..SIGN_WIDTH - local ypos = 9 + local ypos + if signnodename == "mcl_signs:wall_sign" then + ypos = 27 + else + ypos = 9 + end for i = 1, #lines do texture = texture..generate_line(lines[i], ypos) ypos = ypos + LINE_HEIGHT @@ -120,7 +125,7 @@ local generate_texture = function(lines) return texture end -local n = 7/16 - 1/128 +local n = 23/56 - 1/128 local signtext_info_wall = { {delta = {x = 0, y = 0, z = n}, yaw = 0}, @@ -178,7 +183,7 @@ local update_sign = function(pos, fields, sender) local objects = minetest.get_objects_inside_radius(pos, 0.5) for _, v in ipairs(objects) do if v:get_entity_name() == "mcl_signs:text" then - v:set_properties({textures={generate_texture(create_lines(text))}}) + v:set_properties({textures={generate_texture(create_lines(text), v:get_luaentity()._signnodename)}}) return end end @@ -206,6 +211,7 @@ local update_sign = function(pos, fields, sender) elseif nn == "mcl_signs:standing_sign67_5" then sign_info.yaw = sign_info.yaw + 3 * (math.pi / 8) end + text_entity:get_luaentity()._signnodename = nn text_entity:setyaw(sign_info.yaw) end @@ -241,9 +247,10 @@ minetest.register_node("mcl_signs:wall_sign", { paramtype = "light", sunlight_propagates = true, paramtype2 = "wallmounted", - drawtype = "nodebox", - node_box = {type = "wallmounted", wall_side = {-0.499, -1/16, -7/16, -7/16, 7/16, 7/16}}, - tiles = {"mcl_signs_sign_wall.png"}, + drawtype = "mesh", + mesh = "mcl_signs_signonwallmount.obj", + selection_box = {type = "wallmounted", wall_side = {-0.5, -7/28, -0.5, -23/56, 7/28, 0.5}}, + tiles = {"mcl_signs_sign.png"}, groups = sign_groups, stack_max = 16, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -276,6 +283,7 @@ minetest.register_node("mcl_signs:wall_sign", { local sign_info local place_pos + local nodeitem = ItemStack(itemstack) -- Ceiling if wdir == 0 then --how would you add sign to ceiling? @@ -286,7 +294,6 @@ minetest.register_node("mcl_signs:wall_sign", { place_pos = above -- Determine the sign rotation based on player's yaw - local stand = ItemStack(itemstack) local yaw = math.pi*2 - placer:get_look_horizontal() -- Select one of 16 possible rotations (0-15) @@ -300,18 +307,18 @@ minetest.register_node("mcl_signs:wall_sign", { -- The actual rotation is a combination of predefined mesh and facedir (see node definition) if rotation_level % 4 == 0 then - stand:set_name("mcl_signs:standing_sign") + nodeitem:set_name("mcl_signs:standing_sign") elseif rotation_level % 4 == 1 then - stand:set_name("mcl_signs:standing_sign22_5") + nodeitem:set_name("mcl_signs:standing_sign22_5") elseif rotation_level % 4 == 2 then - stand:set_name("mcl_signs:standing_sign45") + nodeitem:set_name("mcl_signs:standing_sign45") elseif rotation_level % 4 == 3 then - stand:set_name("mcl_signs:standing_sign67_5") + nodeitem:set_name("mcl_signs:standing_sign67_5") end fdir = math.floor(rotation_level / 4) -- Place the node! - local _, success = minetest.item_place_node(stand, placer, pointed_thing, fdir) + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) if not success then return itemstack end @@ -327,11 +334,12 @@ minetest.register_node("mcl_signs:wall_sign", { sign_info = signtext_info_wall[fdir + 1] end - local text = minetest.add_entity({ + local text_entity = minetest.add_entity({ x = place_pos.x + sign_info.delta.x, y = place_pos.y + sign_info.delta.y, z = place_pos.z + sign_info.delta.z}, "mcl_signs:text") - text:setyaw(sign_info.yaw) + text_entity:setyaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() if not minetest.setting_getbool("creative_mode") then itemstack:take_item() @@ -409,14 +417,23 @@ minetest.register_entity("mcl_signs:text", { physical = false, collide_with_objects = false, - on_activate = function(self) + _signnodename = nil, -- node name of sign node to which the text belongs + + on_activate = function(self, staticdata) + if staticdata then + self._signnodename = staticdata._signnodename + end local meta = minetest.get_meta(self.object:getpos()) local text = meta:get_string("text") self.object:set_properties({ - textures={generate_texture(create_lines(text))}, + textures={generate_texture(create_lines(text), self._signnodename)}, }) self.object:set_armor_groups({ immortal = 1 }) - end + end, + get_staticdata = function(self) + local out = { self._signnodename } + return minetest.serialize(out) + end, }) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_signs/models/mcl_signs_signonwallmount.obj b/mods/ITEMS/mcl_signs/models/mcl_signs_signonwallmount.obj new file mode 100644 index 0000000000..098cdb965a --- /dev/null +++ b/mods/ITEMS/mcl_signs/models/mcl_signs_signonwallmount.obj @@ -0,0 +1,40 @@ +# Blender v2.76 (sub 0) OBJ File: 'signonwallmount.blend' +# www.blender.org +mtllib signonwallmount.mtl +o wood_Cube.001 +v 0.499985 -0.416668 -0.249992 +v 0.499985 -0.416668 0.249993 +v 0.499985 -0.499999 -0.249992 +v 0.499985 -0.499999 0.249993 +v -0.499985 -0.416668 -0.249993 +v -0.499985 -0.416668 0.249992 +v -0.499985 -0.499999 -0.249993 +v -0.499985 -0.499999 0.249992 +vt 0.031250 0.562500 +vt 0.031250 0.937500 +vt 0.000000 0.937500 +vt 0.000000 0.562500 +vt 0.812500 0.562500 +vt 0.812500 0.937500 +vt 0.437500 0.937500 +vt 0.437500 0.562500 +vt 0.406250 0.937500 +vt 0.406250 0.562500 +vt 0.406250 1.000000 +vt 0.781250 1.000000 +vt 0.781250 0.937500 +vt 0.031250 1.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 -1.000000 -0.000000 +vn -1.000000 0.000000 -0.000000 +vn -0.000000 1.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn -0.000000 -0.000000 1.000000 +usemtl None +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/5/2 4/6/2 8/7/2 7/8/2 +f 7/8/3 8/7/3 6/9/3 5/10/3 +f 5/10/4 6/9/4 2/2/4 1/1/4 +f 3/11/5 7/12/5 5/13/5 1/9/5 +f 8/11/6 4/14/6 2/2/6 6/9/6 diff --git a/mods/ITEMS/mcl_signs/textures/mcl_signs_sign_wall.png b/mods/ITEMS/mcl_signs/textures/mcl_signs_sign_wall.png deleted file mode 100644 index dced78e40c4c5270ac27ac927b21fe3b43f48ba7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv3GfMVburhr(O2`f)(dwrnOz&V zsx4zfD}(jkYDhB1Yi)lf9@Pmyx!BrF{FY~_oN{o zqoc_2hxhBtlmbued&t1Ec2d+s4lD5@S@nlZhvXdIbSH)GRu;TFy(Z{X-kwI)%a0)z4*}Q$iB}N-$-t From 868a99055189eb2318a9a7c99a3d1a98ad69b991 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 15:19:35 +0200 Subject: [PATCH 08/11] Add standing sign models --- mods/ITEMS/mcl_signs/init.lua | 11 ++-- .../mcl_signs/models/mcl_signs_1sign0.obj | 66 +++++++++++++++++++ .../mcl_signs/models/mcl_signs_1sign22.5.obj | 66 +++++++++++++++++++ .../mcl_signs/models/mcl_signs_1sign45.obj | 66 +++++++++++++++++++ .../mcl_signs/models/mcl_signs_1sign67.5.obj | 66 +++++++++++++++++++ 5 files changed, 269 insertions(+), 6 deletions(-) create mode 100644 mods/ITEMS/mcl_signs/models/mcl_signs_1sign0.obj create mode 100644 mods/ITEMS/mcl_signs/models/mcl_signs_1sign22.5.obj create mode 100644 mods/ITEMS/mcl_signs/models/mcl_signs_1sign45.obj create mode 100644 mods/ITEMS/mcl_signs/models/mcl_signs_1sign67.5.obj diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index af707b0e8a..769d721e56 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -116,7 +116,7 @@ local generate_texture = function(lines, signnodename) if signnodename == "mcl_signs:wall_sign" then ypos = 27 else - ypos = 9 + ypos = 0 end for i = 1, #lines do texture = texture..generate_line(lines[i], ypos) @@ -140,7 +140,6 @@ local m = -1/16 + 1/64 for rot=0, 15 do local yaw = math.pi*2 - (((math.pi*2) / 16) * rot) local delta = vector.multiply(minetest.yaw_to_dir(yaw), m) - delta.y = 5/32 table.insert(signtext_info_standing, { delta = delta, yaw = yaw }) end @@ -374,7 +373,7 @@ local ssign = { is_ground_content = false, paramtype2 = "facedir", drawtype = "mesh", - mesh = "mcl_signs_sign.obj", + mesh = "mcl_signs_1sign0.obj", selection_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}}, tiles = {"mcl_signs_sign.png"}, groups = sign_groups, @@ -396,17 +395,17 @@ local ssign = { -- 22.5° minetest.register_node("mcl_signs:standing_sign", ssign) local ssign22_5 = table.copy(ssign) -ssign22_5.mesh = "mcl_signs_sign22.5.obj" +ssign22_5.mesh = "mcl_signs_1sign22.5.obj" -- 45° minetest.register_node("mcl_signs:standing_sign22_5", ssign22_5) local ssign45 = table.copy(ssign) -ssign45.mesh = "mcl_signs_sign45.obj" +ssign45.mesh = "mcl_signs_1sign45.obj" minetest.register_node("mcl_signs:standing_sign45", ssign45) -- 67.5° local ssign67 = table.copy(ssign) -ssign67.mesh = "mcl_signs_sign67.5.obj" +ssign67.mesh = "mcl_signs_1sign67.5.obj" minetest.register_node("mcl_signs:standing_sign67_5", ssign67) diff --git a/mods/ITEMS/mcl_signs/models/mcl_signs_1sign0.obj b/mods/ITEMS/mcl_signs/models/mcl_signs_1sign0.obj new file mode 100644 index 0000000000..9ffba988d0 --- /dev/null +++ b/mods/ITEMS/mcl_signs/models/mcl_signs_1sign0.obj @@ -0,0 +1,66 @@ +# Blender v2.76 (sub 0) OBJ File: '1sign0.blend' +# www.blender.org +mtllib 1sign0.mtl +o wood_Cube.001 +v 0.461724 0.038277 -0.038477 +v 0.461724 0.500000 -0.038477 +v 0.461724 0.038277 0.038477 +v 0.461724 0.500000 0.038477 +v -0.461724 0.038277 -0.038477 +v -0.461724 0.500000 -0.038477 +v -0.461724 0.038277 0.038477 +v -0.461724 0.500000 0.038477 +v 0.038477 -0.499999 -0.038477 +v 0.038477 0.038679 -0.038477 +v 0.038477 -0.499999 0.038477 +v 0.038477 0.038679 0.038477 +v -0.038477 -0.499999 -0.038477 +v -0.038477 0.038679 -0.038477 +v -0.038477 -0.499999 0.038477 +v -0.038477 0.038679 0.038477 +vt 0.031250 0.562500 +vt 0.031250 0.937500 +vt 0.000000 0.937500 +vt 0.000000 0.562500 +vt 0.812500 0.562500 +vt 0.812500 0.937500 +vt 0.437500 0.937500 +vt 0.437500 0.562500 +vt 0.406250 0.937500 +vt 0.406250 0.562500 +vt 0.406250 1.000000 +vt 0.781250 1.000000 +vt 0.781250 0.937500 +vt 0.031250 1.000000 +vt 0.031250 0.062500 +vt 0.031250 0.500000 +vt 0.000000 0.500000 +vt 0.000000 0.062500 +vt 0.125000 0.062500 +vt 0.125000 0.500000 +vt 0.093750 0.500000 +vt 0.093750 0.062500 +vt 0.062500 0.500000 +vt 0.062500 0.062500 +vt 0.093750 0.562500 +vt 0.062500 0.562500 +vn 1.000000 0.000000 0.000000 +vn -0.000000 0.000000 1.000000 +vn -1.000000 0.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +usemtl None +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/5/2 4/6/2 8/7/2 7/8/2 +f 7/8/3 8/7/3 6/9/3 5/10/3 +f 5/10/4 6/9/4 2/2/4 1/1/4 +f 3/11/5 7/12/5 5/13/5 1/9/5 +f 8/11/6 4/14/6 2/2/6 6/9/6 +f 9/15/1 10/16/1 12/17/1 11/18/1 +f 11/19/2 12/20/2 16/21/2 15/22/2 +f 15/22/3 16/21/3 14/23/3 13/24/3 +f 13/24/4 14/23/4 10/16/4 9/15/4 +f 11/23/5 15/21/5 13/25/5 9/26/5 +f 16/16/6 12/23/6 10/26/6 14/1/6 diff --git a/mods/ITEMS/mcl_signs/models/mcl_signs_1sign22.5.obj b/mods/ITEMS/mcl_signs/models/mcl_signs_1sign22.5.obj new file mode 100644 index 0000000000..d502db793b --- /dev/null +++ b/mods/ITEMS/mcl_signs/models/mcl_signs_1sign22.5.obj @@ -0,0 +1,66 @@ +# Blender v2.76 (sub 0) OBJ File: '1sign22.5.blend' +# www.blender.org +mtllib 1sign22.5.mtl +o wood_Cube.001 +v 0.441302 0.038277 0.141146 +v 0.441302 0.500000 0.141146 +v 0.411853 0.038277 0.212242 +v 0.411853 0.500000 0.212242 +v -0.411853 0.038277 -0.212242 +v -0.411853 0.500000 -0.212242 +v -0.441302 0.038277 -0.141146 +v -0.441302 0.500000 -0.141146 +v 0.050273 -0.499999 -0.020824 +v 0.050273 0.038679 -0.020824 +v 0.020824 -0.499999 0.050273 +v 0.020824 0.038679 0.050273 +v -0.020824 -0.499999 -0.050273 +v -0.020824 0.038679 -0.050273 +v -0.050273 -0.499999 0.020824 +v -0.050273 0.038679 0.020824 +vt 0.031250 0.562500 +vt 0.031250 0.937500 +vt 0.000000 0.937500 +vt 0.000000 0.562500 +vt 0.812500 0.562500 +vt 0.812500 0.937500 +vt 0.437500 0.937500 +vt 0.437500 0.562500 +vt 0.406250 0.937500 +vt 0.406250 0.562500 +vt 0.406250 1.000000 +vt 0.781250 1.000000 +vt 0.781250 0.937500 +vt 0.031250 1.000000 +vt 0.031250 0.062500 +vt 0.031250 0.500000 +vt 0.000000 0.500000 +vt 0.000000 0.062500 +vt 0.125000 0.062500 +vt 0.125000 0.500000 +vt 0.093750 0.500000 +vt 0.093750 0.062500 +vt 0.062500 0.500000 +vt 0.062500 0.062500 +vt 0.093750 0.562500 +vt 0.062500 0.562500 +vn 0.923900 0.000000 0.382700 +vn -0.382700 0.000000 0.923900 +vn -0.923900 0.000000 -0.382700 +vn 0.382700 0.000000 -0.923900 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +usemtl None +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/5/2 4/6/2 8/7/2 7/8/2 +f 7/8/3 8/7/3 6/9/3 5/10/3 +f 5/10/4 6/9/4 2/2/4 1/1/4 +f 3/11/5 7/12/5 5/13/5 1/9/5 +f 8/11/6 4/14/6 2/2/6 6/9/6 +f 9/15/1 10/16/1 12/17/1 11/18/1 +f 11/19/2 12/20/2 16/21/2 15/22/2 +f 15/22/3 16/21/3 14/23/3 13/24/3 +f 13/24/4 14/23/4 10/16/4 9/15/4 +f 11/23/5 15/21/5 13/25/5 9/26/5 +f 16/16/6 12/23/6 10/26/6 14/1/6 diff --git a/mods/ITEMS/mcl_signs/models/mcl_signs_1sign45.obj b/mods/ITEMS/mcl_signs/models/mcl_signs_1sign45.obj new file mode 100644 index 0000000000..59f0393048 --- /dev/null +++ b/mods/ITEMS/mcl_signs/models/mcl_signs_1sign45.obj @@ -0,0 +1,66 @@ +# Blender v2.76 (sub 0) OBJ File: '1sign45.blend' +# www.blender.org +mtllib 1sign45.mtl +o wood_Cube.001 +v 0.353695 0.038277 0.299281 +v 0.353695 0.500000 0.299281 +v 0.299281 0.038277 0.353696 +v 0.299281 0.500000 0.353696 +v -0.299281 0.038277 -0.353696 +v -0.299281 0.500000 -0.353696 +v -0.353695 0.038277 -0.299281 +v -0.353695 0.500000 -0.299281 +v 0.054415 -0.499999 0.000000 +v 0.054415 0.038679 0.000000 +v -0.000000 -0.499999 0.054415 +v -0.000000 0.038679 0.054415 +v 0.000000 -0.499999 -0.054415 +v 0.000000 0.038679 -0.054415 +v -0.054415 -0.499999 -0.000000 +v -0.054415 0.038679 -0.000000 +vt 0.031250 0.562500 +vt 0.031250 0.937500 +vt 0.000000 0.937500 +vt 0.000000 0.562500 +vt 0.812500 0.562500 +vt 0.812500 0.937500 +vt 0.437500 0.937500 +vt 0.437500 0.562500 +vt 0.406250 0.937500 +vt 0.406250 0.562500 +vt 0.406250 1.000000 +vt 0.781250 1.000000 +vt 0.781250 0.937500 +vt 0.031250 1.000000 +vt 0.031250 0.062500 +vt 0.031250 0.500000 +vt 0.000000 0.500000 +vt 0.000000 0.062500 +vt 0.125000 0.062500 +vt 0.125000 0.500000 +vt 0.093750 0.500000 +vt 0.093750 0.062500 +vt 0.062500 0.500000 +vt 0.062500 0.062500 +vt 0.093750 0.562500 +vt 0.062500 0.562500 +vn 0.707100 0.000000 0.707100 +vn -0.707100 0.000000 0.707100 +vn -0.707100 0.000000 -0.707100 +vn 0.707100 0.000000 -0.707100 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +usemtl None +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/5/2 4/6/2 8/7/2 7/8/2 +f 7/8/3 8/7/3 6/9/3 5/10/3 +f 5/10/4 6/9/4 2/2/4 1/1/4 +f 3/11/5 7/12/5 5/13/5 1/9/5 +f 8/11/6 4/14/6 2/2/6 6/9/6 +f 9/15/1 10/16/1 12/17/1 11/18/1 +f 11/19/2 12/20/2 16/21/2 15/22/2 +f 15/22/3 16/21/3 14/23/3 13/24/3 +f 13/24/4 14/23/4 10/16/4 9/15/4 +f 11/23/5 15/21/5 13/25/5 9/26/5 +f 16/16/6 12/23/6 10/26/6 14/1/6 diff --git a/mods/ITEMS/mcl_signs/models/mcl_signs_1sign67.5.obj b/mods/ITEMS/mcl_signs/models/mcl_signs_1sign67.5.obj new file mode 100644 index 0000000000..e2ae06b494 --- /dev/null +++ b/mods/ITEMS/mcl_signs/models/mcl_signs_1sign67.5.obj @@ -0,0 +1,66 @@ +# Blender v2.76 (sub 0) OBJ File: '1sign67.5.blend' +# www.blender.org +mtllib 1sign67.5.mtl +o wood_Cube.001 +v 0.212242 0.038277 0.411853 +v 0.212242 0.500000 0.411853 +v 0.141146 0.038277 0.441302 +v 0.141146 0.500000 0.441302 +v -0.141146 0.038277 -0.441302 +v -0.141146 0.500000 -0.441302 +v -0.212242 0.038277 -0.411853 +v -0.212242 0.500000 -0.411853 +v 0.050273 -0.499999 0.020824 +v 0.050273 0.038679 0.020824 +v -0.020824 -0.499999 0.050273 +v -0.020824 0.038679 0.050273 +v 0.020824 -0.499999 -0.050273 +v 0.020824 0.038679 -0.050273 +v -0.050273 -0.499999 -0.020824 +v -0.050273 0.038679 -0.020824 +vt 0.031250 0.562500 +vt 0.031250 0.937500 +vt 0.000000 0.937500 +vt 0.000000 0.562500 +vt 0.812500 0.562500 +vt 0.812500 0.937500 +vt 0.437500 0.937500 +vt 0.437500 0.562500 +vt 0.406250 0.937500 +vt 0.406250 0.562500 +vt 0.406250 1.000000 +vt 0.781250 1.000000 +vt 0.781250 0.937500 +vt 0.031250 1.000000 +vt 0.031250 0.062500 +vt 0.031250 0.500000 +vt 0.000000 0.500000 +vt 0.000000 0.062500 +vt 0.125000 0.062500 +vt 0.125000 0.500000 +vt 0.093750 0.500000 +vt 0.093750 0.062500 +vt 0.062500 0.500000 +vt 0.062500 0.062500 +vt 0.093750 0.562500 +vt 0.062500 0.562500 +vn 0.382700 0.000000 0.923900 +vn -0.923900 0.000000 0.382700 +vn -0.382700 0.000000 -0.923900 +vn 0.923900 0.000000 -0.382700 +vn 0.000000 -1.000000 -0.000000 +vn 0.000000 1.000000 0.000000 +usemtl None +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/5/2 4/6/2 8/7/2 7/8/2 +f 7/8/3 8/7/3 6/9/3 5/10/3 +f 5/10/4 6/9/4 2/2/4 1/1/4 +f 3/11/5 7/12/5 5/13/5 1/9/5 +f 8/11/6 4/14/6 2/2/6 6/9/6 +f 9/15/1 10/16/1 12/17/1 11/18/1 +f 11/19/2 12/20/2 16/21/2 15/22/2 +f 15/22/3 16/21/3 14/23/3 13/24/3 +f 13/24/4 14/23/4 10/16/4 9/15/4 +f 11/23/5 15/21/5 13/25/5 9/26/5 +f 16/16/6 12/23/6 10/26/6 14/1/6 From fd281dfe50637966a874039207a9b13eeac1a83d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 15:34:09 +0200 Subject: [PATCH 09/11] Fix some sign serialization bugs --- mods/ITEMS/mcl_signs/init.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index 769d721e56..e6a6b5c476 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -114,9 +114,9 @@ local generate_texture = function(lines, signnodename) local texture = "[combine:"..SIGN_WIDTH.."x"..SIGN_WIDTH local ypos if signnodename == "mcl_signs:wall_sign" then - ypos = 27 + ypos = 29 else - ypos = 0 + ypos = -2 end for i = 1, #lines do texture = texture..generate_line(lines[i], ypos) @@ -419,8 +419,11 @@ minetest.register_entity("mcl_signs:text", { _signnodename = nil, -- node name of sign node to which the text belongs on_activate = function(self, staticdata) - if staticdata then - self._signnodename = staticdata._signnodename + if staticdata ~= nil and staticdata ~= "" then + local des = minetest.deserialize(staticdata) + if des then + self._signnodename = des._signnodename + end end local meta = minetest.get_meta(self.object:getpos()) local text = meta:get_string("text") From 461f5738d53e969f30aa114132ac17f9a52d996a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 15:47:48 +0200 Subject: [PATCH 10/11] Fix incorrect sign entity staticdata activate --- mods/ITEMS/mcl_signs/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index e6a6b5c476..b9eda0d86a 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -433,7 +433,7 @@ minetest.register_entity("mcl_signs:text", { self.object:set_armor_groups({ immortal = 1 }) end, get_staticdata = function(self) - local out = { self._signnodename } + local out = { _signnodename = self._signnodename } return minetest.serialize(out) end, }) From 4ff88e211d7850ef29687f7d4d2d8ae9de86ee4f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 26 Jul 2017 16:02:55 +0200 Subject: [PATCH 11/11] 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,