init.lua 809 B

123456789101112131415161718192021222324
  1. -- Minetest: builtin/client/init.lua
  2. local scriptpath = core.get_builtin_path()..DIR_DELIM
  3. local clientpath = scriptpath.."client"..DIR_DELIM
  4. local commonpath = scriptpath.."common"..DIR_DELIM
  5. dofile(clientpath .. "register.lua")
  6. dofile(commonpath .. "after.lua")
  7. dofile(commonpath .. "chatcommands.lua")
  8. dofile(clientpath .. "chatcommands.lua")
  9. dofile(commonpath .. "vector.lua")
  10. core.register_on_death(function()
  11. core.display_chat_message("You died.")
  12. local formspec = "size[11,5.5]bgcolor[#320000b4;true]" ..
  13. "label[4.85,1.35;" .. fgettext("You died.") .. "]button_exit[4,3;3,0.5;btn_respawn;".. fgettext("Respawn") .."]"
  14. core.show_formspec("bultin:death", formspec)
  15. end)
  16. core.register_on_formspec_input(function(formname, fields)
  17. if formname == "bultin:death" then
  18. core.send_respawn()
  19. end
  20. end)