92 lines
2.9 KiB
Lua
92 lines
2.9 KiB
Lua
function chat_formspec.create_selection_formspec()
|
|
local fs = [[
|
|
formspec_version[6]
|
|
size[16,12]
|
|
dropdown[2.6,2.8;5.9;select;%s;1;false]
|
|
button[9.5,2.8;3,0.8;template;use this template]
|
|
]]
|
|
|
|
local dropdown_items = ""
|
|
for name, _ in pairs(chat_formspec.predefined) do
|
|
dropdown_items = dropdown_items .. name .. ","
|
|
end
|
|
fs = string.format(fs, string.sub(dropdown_items, 1, -2))
|
|
return fs
|
|
end
|
|
|
|
chat_formspec.selection_fs = chat_formspec.create_selection_formspec()
|
|
|
|
chat_formspec.custom_template = [[
|
|
formspec_version[6]
|
|
size[16,12]
|
|
box[0.8,0.4;14.6,7.7;gray]
|
|
container[0.8,0.4]
|
|
%s
|
|
container_end[]
|
|
set_focus[target]
|
|
button[1,10.8;3,0.8;back;Back]
|
|
button[12.4,10.7;3,0.9;send;Send]
|
|
textarea[0.8,8.6;14.6,1.8;change_text_field;change default text;%s]
|
|
button[4.7,10.8;3,0.8;change_text;change text]
|
|
field[8.8,10.9;3,0.8;target;send to player;%s]
|
|
field_close_on_enter[target;false]
|
|
]]
|
|
|
|
function chat_formspec.create_custom_fs(context)
|
|
local fs = string.format(context.fs, context.sender, context.replacement)
|
|
local target = context.target or ""
|
|
return string.format(chat_formspec.custom_template, fs, context.replacement, target)
|
|
end
|
|
|
|
function chat_formspec.create_target_fs(context)
|
|
local fs = [[formspec_version[2]
|
|
size[14.6,7.7]
|
|
set_focus[answer]
|
|
]]
|
|
fs = fs .. string.format(context.fs, context.sender, context.replacement)
|
|
return fs
|
|
end
|
|
|
|
chat_formspec.misc_fs = {}
|
|
chat_formspec.misc_fs.chat_help = [[
|
|
formspec_version[2]
|
|
size[15,10]
|
|
label[6,0.8;How to chat?]
|
|
label[6,0.8;___________]
|
|
label[0.3,1.5;On a computer:]
|
|
label[0.3,1.6;____________]
|
|
|
|
textarea[3,1.35;15,4;;;1) close all pop-ups inside minetest by pressing 'ESC'
|
|
2) Press your 'T' or 'F10' key
|
|
3) Write the text you want to send to the public chat
|
|
in case you do not want everyone to see you text, add a '/m playername' in front of you text.
|
|
only the player with the name you specified will see your text then
|
|
4) send your Text by pressing 'Enter'
|
|
|
|
In case you can't see the chat, try pressing 'F2' to show / hide the chat]
|
|
|
|
label[0.3,4.5;On mobile / tablet:]
|
|
label[0.3,4.6;______________]
|
|
|
|
textarea[3,4.345;15,7;;;1) Close all pop-ups inside Minetest by tapping outside of them
|
|
2) Press the following buttons:
|
|
|
|
=>
|
|
|
|
4) Write the text you want to send to the public chat
|
|
in case you do not want everyone to see you text, add a '/m playername' in front of you text.
|
|
only the player with the name you specified will see your text then
|
|
5) send your Text by pressing 'Enter'
|
|
|
|
In case you can't see chat, try pressing the following buttons
|
|
|
|
=>]
|
|
|
|
image[3,5.05;0.5,0.75;rare_controls.png]
|
|
image[4,5;1,1;chat_btn.png]
|
|
|
|
image[3,8.05;1,1;gear_icon.png]
|
|
image[4.5,8.05;1,1;chat_show_btn.png]
|
|
|
|
button[6,9;3,0.8;ok;OK]
|
|
]] |