diff options
-rw-r--r-- | font_api/init.lua | 6 | ||||
-rw-r--r-- | signs/nodes.lua | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/font_api/init.lua b/font_api/init.lua index 27cba99..2c8f4f3 100644 --- a/font_api/init.lua +++ b/font_api/init.lua @@ -42,6 +42,12 @@ function font_api.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 8e65e27..428da2e 100644 --- a/signs/nodes.lua +++ b/signs/nodes.lua @@ -26,6 +26,16 @@ local function display_poster(pos, node, player) 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 + local font = font_api.get_font(meta:get_string("font") or def.font_name) local fs @@ -34,7 +44,7 @@ local function display_poster(pos, node, player) -- Title texture local titletexture = font:make_text_texture( - meta:get_string("display_text"), font:get_height()*8.4, + d_text, font:get_height()*8.4, font:get_height(), 1, "center") fs = string.format([=[ @@ -44,7 +54,7 @@ local function display_poster(pos, node, player) textarea[0.3,1.5;7,8;;%s;]]=], titletexture, minetest.colorize("#111", - minetest.formspec_escape(meta:get_string("text")))) + minetest.formspec_escape(p_text))) if minetest.is_protected(pos, player:get_player_name()) then fs = string.format("%sbutton_exit[2.5,8;2,1;ok;%s]", fs, F("Close")) |