Improve client-side death formspec

master
Maksim 2022-02-01 13:36:54 +02:00
parent e2ab4ac9d4
commit 90ab16ef7d
1 changed files with 7 additions and 5 deletions

View File

@ -2,15 +2,17 @@
-- handled by the engine.
core.register_on_death(function()
core.display_chat_message(fgettext("You died."))
local formspec = "size[11,5.5]bgcolor[#320000b4;true]" ..
"image_button[2,2;7,0.8;blank.png;;" .. fgettext("You died.") .. ";false;false;]" ..
"button_exit[3.5,3;4,0.5;btn_respawn;".. fgettext("Respawn") .."]"
core.display_chat_message(fgettext("You died"))
local formspec = "size[8,5]bgcolor[#320000b4;true]" ..
"background9[0,0;0,0;bg_common.png;true;40]" ..
"style[you_died;font_size=+4;content_offset=0]" ..
"image_button[0.5,1.5;7,0.8;blank.png;you_died;" .. fgettext("You died") .. ";false;false]" ..
"button_exit[2,3;4,0.5;btn_respawn;".. fgettext("Respawn") .."]"
core.show_formspec("bultin:death", formspec)
end)
core.register_on_formspec_input(function(formname, fields)
if formname == "bultin:death" and fields.btn_respawn then
if formname == "bultin:death" and not fields.you_died then
core.send_respawn()
end
end)