From 9d6d9b11e19522e949eb5ed13e810d56657c9f03 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 9 Sep 2016 04:08:20 -0400 Subject: [PATCH] add support for visible text on default steel signs (if defined by subgame) --- init.lua | 50 +++++++++++++++++++++++++++-- textures/signs_wall_sign_metal.png | Bin 0 -> 553 bytes 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 textures/signs_wall_sign_metal.png diff --git a/init.lua b/init.lua index fd1ca0d..e0bafe2 100644 --- a/init.lua +++ b/init.lua @@ -142,6 +142,7 @@ else end default_sign_metal = "default:sign_wall_steel" +default_sign_metal_image = "default_sign_steel.png" --table copy @@ -515,6 +516,7 @@ signs_lib.update_sign = function(pos, fields, owner) sign_info = signs_lib.hanging_sign_model.textpos[minetest.get_node(pos).param2 + 1] elseif string.find(signnode.name, "sign_wall") then if signnode.name == default_sign + or signnode.name == default_sign_metal or signnode.name == "locked_sign:sign_wall_locked" then sign_info = signs_lib.regular_wall_sign_model.textpos[minetest.get_node(pos).param2 + 1] else @@ -535,6 +537,7 @@ end -- What kind of sign do we need to place, anyway? function signs_lib.determine_sign_type(itemstack, placer, pointed_thing, locked) + print("called signs_lib.determine_sign_type") local name name = minetest.get_node(pointed_thing.under).name if fences_with_sign[name] then @@ -556,11 +559,13 @@ function signs_lib.determine_sign_type(itemstack, placer, pointed_thing, locked) end end + print("protection and position okay") local node=minetest.get_node(pointed_thing.under) 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) else + print("target didn't have rightclick") local above = pointed_thing.above local under = pointed_thing.under local dir = {x = under.x - above.x, @@ -579,7 +584,7 @@ function signs_lib.determine_sign_type(itemstack, placer, pointed_thing, locked) end local fdir = minetest.dir_to_facedir(dir) - + print("facedir = "..fdir) local pt_name = minetest.get_node(under).name local signname = itemstack:get_name() @@ -589,11 +594,17 @@ function signs_lib.determine_sign_type(itemstack, placer, pointed_thing, locked) minetest.add_node(above, {name = "signs:sign_hanging", param2 = fdir}) elseif wdir == 1 and signname == default_sign then minetest.add_node(above, {name = "signs:sign_yard", param2 = fdir}) + elseif signname == default_sign_metal then + minetest.add_node(above, {name = signname, param2 = wdir }) + print("line 597") elseif signname ~= default_sign - and signname ~= "locked_sign:sign_wall_locked" then -- it's a metal wall sign. + and signname ~= default_sign_metal + and signname ~= "locked_sign:sign_wall_locked" then -- it's a signs_lib colored metal wall sign. minetest.add_node(above, {name = signname, param2 = fdir}) + print("line 602") else -- it must be a default or locked wooden wall sign minetest.add_node(above, {name = signname, param2 = wdir }) -- note it's wallmounted here! + print("line 605") if locked then local meta = minetest.get_meta(above) local owner = placer:get_player_name() @@ -795,6 +806,41 @@ minetest.register_node(":locked_sign:sign_wall_locked", { on_rotate = signs_lib.wallmounted_rotate }) +-- default metal sign, if defined + +if minetest.registered_nodes["default:sign_wall_steel"] then + minetest.register_node(":"..default_sign_metal, { + description = S("Sign"), + inventory_image = default_sign_metal_image, + wield_image = default_sign_metal_image, + node_placement_prediction = "", + sunlight_propagates = true, + paramtype = "light", + paramtype2 = "wallmounted", + drawtype = "nodebox", + node_box = signs_lib.regular_wall_sign_model.nodebox, + tiles = {"signs_wall_sign_metal.png"}, + groups = sign_groups, + + on_place = function(itemstack, placer, pointed_thing) + return signs_lib.determine_sign_type(itemstack, placer, pointed_thing) + end, + on_construct = function(pos) + signs_lib.construct_sign(pos) + end, + on_destruct = function(pos) + signs_lib.destruct_sign(pos) + end, + on_receive_fields = function(pos, formname, fields, sender) + signs_lib.receive_fields(pos, formname, fields, sender) + end, + on_punch = function(pos, node, puncher) + signs_lib.update_sign(pos) + end, + on_rotate = signs_lib.wallmounted_rotate + }) +end + -- metal, colored signs local sign_colors = { "green", "yellow", "red", "white_red", "white_black", "orange", "blue", "brown" } diff --git a/textures/signs_wall_sign_metal.png b/textures/signs_wall_sign_metal.png new file mode 100644 index 0000000000000000000000000000000000000000..7eff1a68c7ddf632be6d7802dcfedce3da6c2735 GIT binary patch literal 553 zcmV+^0@nSBP)sxVgExy1Kf%ySu!+yuH1>zP`S{zrVo1z`?=6!otGC!^6bH z#KpzM#>U3S$H&OX$jQmc%gf8p&(G1((bm@1<>lq)=jZ9^>F@9FWs7m40002!NklX?2(=ghW z#SCRN3$%>8+~$mO?oxhA01i9F&&OVQe~=A0`duz^oTiJ{RW6dt8faU@EQ!-uE*>Ae z76I*Ro)?G$5uf7WS=o4hTgjJVR>)@z?^I*AS<7OMS-zAabZbDivJlfK2oizO(5V3V zPLnvAjQnvp@o&v4kaciB3dX+Y4F>(5idH{wdXB@du1hYsI_v0^HM{MOuG5ZQA^-dm r+w8n+Dr{z&Ck?2#bVdD`Dwq2MY9}RLCjG*e00000NkvXXu0mjf*U%pd literal 0 HcmV?d00001