Updated the sleeping formspec for a better look (#4319)

This PR deals with the UI side of #3645 - no logic was changed to prevent the spam related to the `zzZ` button.

The chatbox now only shows in multiplayer, where it belongs. The buttons have also been resized and moved into positions that make them look nicer.

Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4319
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: Nicu <kneekoo@noreply.git.minetest.land>
Co-committed-by: Nicu <kneekoo@noreply.git.minetest.land>
This commit is contained in:
Nicu 2024-05-24 20:35:13 +00:00 committed by the-real-herowl
parent 0a14a74860
commit f119259e67

View file

@ -225,11 +225,9 @@ local function update_formspecs(finished, players)
local button_abort = "button_exit[4,3;4,0.75;leave;"..F(S("Abort sleep")).."]"
local bg_presleep = "bgcolor[#00000080;true]"
local bg_sleep = "bgcolor[#000000FF;true]"
local chatbox = "field[0.2,4.5;9,1;chatmessage;"..F(S("Chat:"))..";]"
local chatsubmit = "button[9.2,3.75;1,2;chatsubmit;"..F(S("send!")).."]"
local defaultmessagebutton = "button[10.2,3.75;1,2;defaultmessage;zzZzzZ]"
form_n = form_n .. chatbox .. chatsubmit --because these should be in the formspec in ANY case, they might as well be added here already
local chatbox = "field[0.3,4.5;10,1;chatmessage;"..F(S("Chat:"))..";]"
local chatsubmit = "button[10,3.73;2,2;chatsubmit;"..F(S("Send")).."]"
local defaultmessagebutton = "button[10.98,2.93;1,2;defaultmessage;zzZ]"
if finished then
for name,_ in pairs(mcl_beds.player) do
@ -237,6 +235,7 @@ local function update_formspecs(finished, players)
end
return
elseif not is_sp then
form_n = form_n .. chatbox .. chatsubmit --because these should be in the formspec in ANY case, they might as well be added here already
local text = S("Players in bed: @1/@2", player_in_bed, ges)
if not night_skip then
text = text .. "\n" .. S("Note: Night skip is disabled.")