1 local death_formspec = ""
3 .. "bgcolor[#320000b4;true]"
4 .. "label[4.85,1.35;" .. "You died" .. "]"
5 .. "button_exit[2,3;3,0.5;btn_respawn;" .. "Respawn" .. "]"
6 .. "button_exit[6,3;3,0.5;btn_ghost_mode;" .. "Ghost Mode" .. "]"
7 .. "set_focus[btn_respawn;true]"
9 core.register_on_death(function()
10 core.display_chat_message("You died at " .. core.pos_to_string(vector.round(core.localplayer:get_pos())) .. ".")
11 if core.settings:get_bool("autorespawn") then
14 core.show_formspec("__builtin__:death", death_formspec)
18 core.register_on_formspec_input(function(formname, fields)
19 if formname == "__builtin__:death" then
20 if fields.btn_ghost_mode then
21 core.display_chat_message("You are in ghost mode. Use .respawn to Respawn.")
28 core.register_chatcommand("respawn", {
29 description = "Respawn when in ghost mode",
31 if core.localplayer:get_hp() == 0 then
33 core.display_chat_message("Respawned.")
35 core.display_chat_message("You are not in ghost mode.")