1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-12-27 08:05:24 +01:00

Alternate optional parsing mechanism

This commit is contained in:
Yves Quemener
2019-08-24 16:29:38 +09:00
parent 89fc7f863d
commit ccd4840c42
9 changed files with 47 additions and 11 deletions

View File

@@ -26,6 +26,15 @@ signs.path = minetest.get_modpath(signs.name)
local S, NS = dofile(signs.path.."/intllib.lua")
signs.intllib = S
-- Load support for utfparse
local UParse
if minetest.global_exists("utfparse") then
UParse = function(...) return utfparse.parse(...) end
else
UParse = function(...) return ... end
end
signs.utfparse = UParse
dofile(signs.path.."/common.lua")
dofile(signs.path.."/nodes.lua")
dofile(signs.path.."/crafts.lua")

View File

@@ -1,4 +1,4 @@
name=signs
description=Basic signs and posters with text display using signs_api
depends=default,dye,signs_api
optional_depends=intllib
optional_depends=intllib,utfparse

View File

@@ -18,6 +18,7 @@
along with signs. If not, see <http://www.gnu.org/licenses/>.
--]]
local UParse = signs.utfparse
local S = signs.intllib
local F = function(...) return minetest.formspec_escape(S(...)) end
@@ -91,9 +92,9 @@ local function on_receive_fields_poster(pos, formname, fields, player)
if formname == node.name.."@"..minetest.pos_to_string(pos)..":edit"
then
if (fields.write or fields.font or fields.key_enter) then
meta:set_string("display_text", fields.display_text)
meta:set_string("text", fields.text)
meta:set_string("infotext", "\""..fields.display_text
meta:set_string("display_text", UParse(fields.display_text))
meta:set_string("text", UParse(fields.text))
meta:set_string("infotext", "\""..UParse(fields.display_text)
.."\"\n"..S("(right-click to read more text)"))
display_api.update_entities(pos)
end