mirror of
https://github.com/pyrollo/display_modpack.git
synced 2025-10-14 08:15:20 +02:00
Bugfix
This commit is contained in:
@@ -54,15 +54,15 @@ local function show_node_formspec(playername, pos)
|
|||||||
fs = fs:gsub("context", nodemeta)
|
fs = fs:gsub("context", nodemeta)
|
||||||
|
|
||||||
-- Change all ${} to their corresponding metadata values
|
-- Change all ${} to their corresponding metadata values
|
||||||
local s, e
|
fs = fs:gsub("(.)${(.*)}", function(prefix, key)
|
||||||
repeat
|
-- Don't alter escaped keys
|
||||||
s, e = fs:find('%${.*}')
|
if prefix == "\\" then
|
||||||
if s and e then
|
return prefix .. "${" .. key .. "}"
|
||||||
fs = fs:sub(1, s-1)..
|
|
||||||
minetest.formspec_escape(meta:get_string(fs:sub(s+2,e-1)))..
|
|
||||||
fs:sub(e+1)
|
|
||||||
end
|
end
|
||||||
until s == nil
|
|
||||||
|
-- Get the node meta value
|
||||||
|
return prefix .. minetest.formspec_escape(meta:get_string(key))
|
||||||
|
end)
|
||||||
|
|
||||||
local context = get_context(playername)
|
local context = get_context(playername)
|
||||||
context.node_pos = pos
|
context.node_pos = pos
|
||||||
|
@@ -28,6 +28,11 @@ local FS = function(...) return minetest.formspec_escape(S(...)) end
|
|||||||
|
|
||||||
function signs_api.set_display_text(pos, text, font)
|
function signs_api.set_display_text(pos, text, font)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
-- Horrible workaround to prevent the engine from trying to resolve
|
||||||
|
-- metadata keys
|
||||||
|
if text:sub(1, 2) == "${" and text:sub(-1) == "}" then
|
||||||
|
text = text .. " "
|
||||||
|
end
|
||||||
meta:set_string("display_text", text)
|
meta:set_string("display_text", text)
|
||||||
if text and text ~= "" then
|
if text and text ~= "" then
|
||||||
meta:set_string("infotext", "\""..text.."\"")
|
meta:set_string("infotext", "\""..text.."\"")
|
||||||
|
Reference in New Issue
Block a user