mirror of
https://github.com/pyrollo/display_modpack.git
synced 2025-10-15 08:35:35 +02:00
Escape formspec content of boards and steles
This commit is contained in:
@@ -31,9 +31,10 @@ dofile(boards.path.."/font_tinycurs.lua")
|
|||||||
|
|
||||||
local function set_formspec(pos)
|
local function set_formspec(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
local display_text = minetest.formspec_escape(meta:get_string("display_text"))
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"size[6,4]"..default.gui_bg..default.gui_bg_img..default.gui_slots..
|
"size[6,4]"..default.gui_bg..default.gui_bg_img..default.gui_slots..
|
||||||
"textarea[0.5,0.7;5.5,3;display_text;"..FS("Text")..";${display_text}]"..
|
"textarea[0.5,0.7;5.5,3;display_text;"..FS("Text")..";" .. display_text .. "]"..
|
||||||
"button_exit[3,3.5;2,1;ok;"..FS("Write").."]"..
|
"button_exit[3,3.5;2,1;ok;"..FS("Write").."]"..
|
||||||
"button_exit[1,3.5;2,1;wipe;"..FS("Wipe").."]")
|
"button_exit[1,3.5;2,1;wipe;"..FS("Wipe").."]")
|
||||||
end
|
end
|
||||||
@@ -83,6 +84,9 @@ local models = {
|
|||||||
set_formspec(pos)
|
set_formspec(pos)
|
||||||
display_api.update_entities(pos)
|
display_api.update_entities(pos)
|
||||||
end,
|
end,
|
||||||
|
on_rightclick = function(pos)
|
||||||
|
set_formspec(pos)
|
||||||
|
end,
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@@ -32,6 +32,20 @@ for i, material in ipairs(steles.materials) do
|
|||||||
local parts = material:split(":")
|
local parts = material:split(":")
|
||||||
groups.display_api = 1
|
groups.display_api = 1
|
||||||
|
|
||||||
|
local function set_formspec(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local display_text = minetest.formspec_escape(meta:get_string("display_text"))
|
||||||
|
meta:set_string("formspec", string.format([=[
|
||||||
|
size[6,4]%s%s%s
|
||||||
|
textarea[0.5,0.7;5.5,2;display_text;%s;%s]
|
||||||
|
button[1,3;2,1;font;%s]
|
||||||
|
button_exit[3,3;2,1;ok;%s]]=],
|
||||||
|
default.gui_bg, default.gui_bg_img, default.gui_slots,
|
||||||
|
FS("Displayed text (3 lines max)"),
|
||||||
|
display_text,
|
||||||
|
FS("Font"), FS("Write")))
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("steles:"..parts[2].."_stele", {
|
minetest.register_node("steles:"..parts[2].."_stele", {
|
||||||
description = steles.materials_desc[i],
|
description = steles.materials_desc[i],
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
@@ -62,17 +76,12 @@ for i, material in ipairs(steles.materials) do
|
|||||||
return display_api.on_place(itemstack, placer, pointed_thing)
|
return display_api.on_place(itemstack, placer, pointed_thing)
|
||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
set_formspec(pos)
|
||||||
meta:set_string("formspec", string.format([=[
|
|
||||||
size[6,4]%s%s%s
|
|
||||||
textarea[0.5,0.7;5.5,2;display_text;%s;${display_text}]
|
|
||||||
button[1,3;2,1;font;%s]
|
|
||||||
button_exit[3,3;2,1;ok;%s]]=],
|
|
||||||
default.gui_bg, default.gui_bg_img, default.gui_slots,
|
|
||||||
FS("Displayed text (3 lines max)"),
|
|
||||||
FS("Font"), FS("Write")))
|
|
||||||
display_api.on_construct(pos)
|
display_api.on_construct(pos)
|
||||||
end,
|
end,
|
||||||
|
on_rightclick = function(pos)
|
||||||
|
set_formspec(pos)
|
||||||
|
end,
|
||||||
on_destruct = display_api.on_destruct,
|
on_destruct = display_api.on_destruct,
|
||||||
on_rotate = display_api.on_rotate,
|
on_rotate = display_api.on_rotate,
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
on_receive_fields = function(pos, formname, fields, player)
|
||||||
|
Reference in New Issue
Block a user