mirror of
https://github.com/pyrollo/display_modpack.git
synced 2025-12-26 15:45:28 +01:00
Alternate optional parsing mechanism
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user