diff options
author | orwell96 <orwell@bleipb.de> | 2018-01-11 22:18:12 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-01-11 22:29:15 +0100 |
commit | eccdad46ef2b38cd061aab7ae6bcb252a67c2218 (patch) | |
tree | 2e8cd191e6a712559eb6bfc69088d1de581f4120 | |
parent | 0fa101e1c0b5e585f23bb9cfa531bfc851de5e0b (diff) | |
download | display_modpack-eccdad46ef2b38cd061aab7ae6bcb252a67c2218.tar.gz display_modpack-eccdad46ef2b38cd061aab7ae6bcb252a67c2218.tar.bz2 display_modpack-eccdad46ef2b38cd061aab7ae6bcb252a67c2218.zip |
Use signs_lib's sign macros
-rw-r--r-- | font_lib/init.lua | 8 | ||||
-rw-r--r-- | signs/nodes.lua | 16 |
2 files changed, 20 insertions, 4 deletions
diff --git a/font_lib/init.lua b/font_lib/init.lua index 9b10e76..ea0c056 100644 --- a/font_lib/init.lua +++ b/font_lib/init.lua @@ -259,7 +259,13 @@ function font_lib.on_display_update(pos, objref) local text = meta:get_string("display_text") local ndef = minetest.registered_nodes[minetest.get_node(pos).name] local entity = objref:get_luaentity() - + + -- If orwell96's modified signs_lib version is available and sign macros are active, + -- replace them in display_lib's text too. + if signs_lib and signs_lib.replace_macros then + text = signs_lib.replace_macros(text) + end + if entity and ndef.display_entities[entity.name] then local def = ndef.display_entities[entity.name] diff --git a/signs/nodes.lua b/signs/nodes.lua index 2b8ab66..ef7cea5 100644 --- a/signs/nodes.lua +++ b/signs/nodes.lua @@ -26,17 +26,27 @@ local function display_poster(pos, node, player) local formspec local meta = minetest.get_meta(pos) local def = minetest.registered_nodes[node.name].display_entities["signs:display_text"] - + + local p_text = meta:get_string("text") + local d_text = meta:get_string("display_text") + -- If orwell96's modified signs_lib version is available and sign macros are active, + -- replace them in display_lib's text too. + if signs_lib and signs_lib.replace_macros then + p_text = signs_lib.replace_macros(p_text) + d_text = signs_lib.replace_macros(d_text) + end + -- Title texture local titletexture = font_lib.make_multiline_texture( - def.font_name, meta:get_string("display_text"), + def.font_name, d_text, 116, 12, def.maxlines, def.valign, def.color) + formspec = "size[7,9]".. "background[0,0;7,9;signs_poster_formspec.png]".. "image[0,0;8.4,1.5;"..titletexture.."]".. - "textarea[0.3,1.5;7,8;;"..minetest.colorize("#111", minetest.formspec_escape(meta:get_string("text")))..";]".. + "textarea[0.3,1.5;7,8;;"..minetest.colorize("#111", minetest.formspec_escape(p_text))..";]".. "bgcolor[#0000]" if minetest.is_protected(pos, player:get_player_name()) then |