Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion boards/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ boards = {}
boards.name = minetest.get_current_modname()
boards.path = minetest.get_modpath(boards.name)

-- Load support for utfparse
local UParse
if minetest.global_exists("utfparse") then
UParse = function(...) return utfparse.parse(...) end
else
UParse = function(...) return ... end
end

-- Load support for intllib.
local S, NS = dofile(boards.path.."/intllib.lua")
boards.intllib = S
Expand All @@ -43,7 +51,7 @@ end
local function on_receive_fields(pos, formname, fields, player)
if fields then
if fields.ok or fields.key_enter then
signs_api.set_display_text(pos, fields.display_text, fields.font)
signs_api.set_display_text(pos, UParse(fields.display_text), fields.font)
end
if fields.wipe then
signs_api.set_display_text(pos, "", fields.font)
Expand Down
9 changes: 9 additions & 0 deletions signs/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion signs/mod.conf
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions signs/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions signs_api/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ signs_api = {}
signs_api.name = minetest.get_current_modname()
signs_api.path = minetest.get_modpath(signs_api.name)

-- 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_api.utfparse = UParse

-- Load support for intllib.
local S, NS = dofile(signs_api.path.."/intllib.lua")
signs_api.intllib = S
Expand Down Expand Up @@ -77,10 +86,10 @@ end
function signs_api.on_receive_fields(pos, formname, fields, player)
if not minetest.is_protected(pos, player:get_player_name()) then
if fields and (fields.ok or fields.key_enter) then
signs_api.set_display_text(pos, fields.display_text)
signs_api.set_display_text(pos, UParse(fields.display_text))
end
if fields and (fields.font) then
signs_api.set_display_text(pos, fields.display_text)
signs_api.set_display_text(pos, UParse(fields.display_text))
font_api.show_font_list(player, pos)
end
end
Expand Down
2 changes: 1 addition & 1 deletion signs_api/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name=signs_api
description=A library providing various helper functions for registereing signs with text display
depends=default,display_api,font_api
optional_depends=intllib
optional_depends=intllib,utfparse
8 changes: 8 additions & 0 deletions steles/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ steles.path = minetest.get_modpath(steles.name)
-- Load support for intllib.
local S, NS = dofile(steles.path.."/intllib.lua")
steles.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
steles.utfparse = UParse

dofile(steles.path.."/config.lua")
dofile(steles.path.."/nodes.lua")
Expand Down
2 changes: 1 addition & 1 deletion steles/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name=steles
description=Stone steles with text display on them
depends=default,display_api,font_api
optional_depends=intllib,technic
optional_depends=intllib,technic,utfparse
5 changes: 3 additions & 2 deletions steles/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
along with steles. If not, see <http://www.gnu.org/licenses/>.
--]]

local UParse = steles.utfparse
local S = steles.intllib
local F = function(...) return minetest.formspec_escape(S(...)) end

Expand Down Expand Up @@ -79,8 +80,8 @@ for i, material in ipairs(steles.materials) do
if not minetest.is_protected(pos, player:get_player_name()) then
local meta = minetest.get_meta(pos)
if fields.ok or fields.font then
meta:set_string("display_text", fields.display_text)
meta:set_string("infotext", "\""..fields.display_text.."\"")
meta:set_string("display_text", UParse(fields.display_text))
meta:set_string("infotext", "\""..UParse(fields.display_text).."\"")
display_api.update_entities(pos)
end
if fields.font then
Expand Down