mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
[CSM] Add local formspecs. (#5094)
This commit is contained in:
parent
2c19d51409
commit
c42c53fccf
12 changed files with 126 additions and 67 deletions
|
@ -6,8 +6,18 @@ local commonpath = scriptpath.."common"..DIR_DELIM
|
|||
dofile(clientpath .. "register.lua")
|
||||
dofile(commonpath .. "after.lua")
|
||||
dofile(commonpath .. "chatcommands.lua")
|
||||
dofile(clientpath .. "chatcommands.lua")
|
||||
dofile(clientpath .. "preview.lua")
|
||||
|
||||
core.register_on_death(function()
|
||||
core.display_chat_message("You died.")
|
||||
local formspec = "size[11,5.5]bgcolor[#320000b4;true]" ..
|
||||
"label[4.85,1.35;" .. fgettext("You died.") .. "]button_exit[4,3;3,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" then
|
||||
core.send_respawn()
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -32,7 +32,7 @@ end)
|
|||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_chatcommand("dump", {
|
||||
func = function(name, param)
|
||||
func = function(param)
|
||||
return true, dump(_G)
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -62,5 +62,6 @@ core.registered_on_sending_chat_messages, core.register_on_sending_chat_messages
|
|||
core.registered_on_death, core.register_on_death = make_registration()
|
||||
core.registered_on_hp_modification, core.register_on_hp_modification = make_registration()
|
||||
core.registered_on_damage_taken, core.register_on_damage_taken = make_registration()
|
||||
core.registered_on_formspec_input, core.register_on_formspec_input = make_registration()
|
||||
|
||||
|
||||
|
|
|
@ -606,7 +606,9 @@ if INIT == "mainmenu" then
|
|||
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
if INIT == "client" or INIT == "mainmenu" then
|
||||
function fgettext_ne(text, ...)
|
||||
text = core.gettext(text)
|
||||
local arg = {n=select('#', ...), ...}
|
||||
|
@ -636,4 +638,3 @@ if INIT == "mainmenu" then
|
|||
return core.formspec_escape(fgettext_ne(text, ...))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue