mirror of
https://github.com/pyrollo/display_modpack.git
synced 2025-10-14 16:25:20 +02:00
Improve exploit fix (#8)
This commit is contained in:
@@ -54,13 +54,7 @@ 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
|
||||||
fs = fs:gsub("(.)${(.-)}", function(prefix, key)
|
fs = fs:gsub("([^\\])${(.-)}", function(prefix, key)
|
||||||
-- Don't alter escaped keys
|
|
||||||
if prefix == "\\" then
|
|
||||||
return prefix .. "${" .. key .. "}"
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get the node meta value
|
|
||||||
return prefix .. minetest.formspec_escape(meta:get_string(key))
|
return prefix .. minetest.formspec_escape(meta:get_string(key))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@@ -28,11 +28,6 @@ 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