From 509b15ee00cc9af48b2cd71853c57efd33e2fdb8 Mon Sep 17 00:00:00 2001 From: tour Date: Fri, 5 Jan 2024 17:04:17 +0100 Subject: [PATCH] demo chat_help formspec will most likely break on other screen sizes --- show-receive.lua | 2 +- specs.lua | 59 ++++++++++++++++++++++++++++++++++-------------- todo.txt | 5 ---- 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/show-receive.lua b/show-receive.lua index 4644252..3de51ac 100644 --- a/show-receive.lua +++ b/show-receive.lua @@ -114,7 +114,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.show_formspec(name, "chat_formspec:predefined", chat_formspec.get_predefined_template(context)) elseif fields.send then if not minetest.check_player_privs(name, chat_formspec.predefined_priv) then return true end - local fs = chat_formspec.create_targest_fs(context.id, context.replacement) + local fs = chat_formspec.create_target_fs(context.id, context.replacement) chat_formspec.show_to_target(name, fs) end if fields.quit then diff --git a/specs.lua b/specs.lua index 1b4e511..8754ee7 100644 --- a/specs.lua +++ b/specs.lua @@ -28,7 +28,7 @@ Please make sure the field the player should answer with has the name "answer"] textarea[0.8,3.4;14,5.4;c_fs;your custom formspec;] textarea[0.8,8.9;13.7,1.1;;;There is no validation check done for this formspec. -If you are not sure wheter it looks correct\, consider sending it to yourself] +If you are not sure whether it looks correct\, consider sending it to yourself] button_exit[0.8,10.5;3,0.8;cancel;Cancel] field_close_on_enter[target;false] @@ -69,7 +69,7 @@ function chat_formspec.get_predefined_template(context) return fs end -function chat_formspec.create_targest_fs(id, replacement) +function chat_formspec.create_target_fs(id, replacement) if not chat_formspec.predefined[id] then return end -- in case someone hacks their client and sends an invalid id in their fs submission local fs = [[formspec_version[2] size[14.6,7.7] @@ -85,21 +85,46 @@ end chat_formspec.misc_fs = {} chat_formspec.misc_fs.chat_help = [[ - formspec_version[2] - size[14,10] - label[5.5,0.8;How to chat?] - label[5.5,0.8;___________] - label[0.3,1.5;On a computer:] - label[0.3,1.6;____________] - textarea[3,1.5;10.4,2.4;;;1) Press your 'T' or 'F10' key -2) 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 -3) send your Text by pressing 'Enter'] - label[0.3,4.3;On mobile / tablet:] - label[0.3,4.4;______________] - textarea[3.4,4.3;9.7,2.6;;;TODO: WRITE TEXT] - button[5.6,8.6;3,0.8;ok;OK] +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] ]] chat_formspec.misc_fs.replant_help = [[ diff --git a/todo.txt b/todo.txt index 158fed4..67f51c7 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,3 @@ -check to not send formspecs to death players :/ (done?) -priv checks (bailiff / staff) before sending out a formspec to the target (done?) -do I have to fs-escape chat messages? - -create formspecs how to replant / how to chat (done, with strange issue on quit-event) add a licence colorize answers / maybe even play a notification sound to provent the message getting lost in the chat flow translation