Merge pull request 'Enable mcl_title debug code, debug priv to chatcmds' (#2735) from title-API-fixes_enable-debug into title-API-fixes

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2735
This commit is contained in:
cora 2022-10-09 19:33:36 +00:00
commit ba6dfc7368

View File

@ -219,56 +219,63 @@ end)
--DEBUG STUFF!!
--[[
--TODO:Proper /title command that can send the title to other players.
--These commands are just for debugging right now.
local dbg_msg = "Note that these are just debug commands right now. e.g. the title is only sent to he player issuing the command. Proper /title commands will be added in the future."
minetest.register_chatcommand("title", {
privs = { debug = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
if player then
mcl_title.set(player, "title", { text = param, color = "gold", bold = true, italic = true })
return true
return true, dbg_msg
else
return false
return false, dbg_msg
end
end,
})
minetest.register_chatcommand("subtitle", {
privs = { debug = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
if player then
mcl_title.set(player, "subtitle", { text = param, color = "gold" })
return true
return true, dbg_msg
else
return false
return false, dbg_msg
end
end,
})
minetest.register_chatcommand("actionbar", {
privs = { debug = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
if player then
mcl_title.set(player, "actionbar", { text = param, color = "gold" })
return true
mcl_title.set(player, "actionbar", { text = param, color = "gold", bold = true, italic = true })
return true, dbg_msg
else
return false
return false, dbg_msg
end
end,
})
minetest.register_chatcommand("timeout", {
minetest.register_chatcommand("title_timeout", {
privs = { debug = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
if player then
mcl_title.params_set(player, { stay = 600 })
return true
return true, dbg_msg
else
return false
return false, dbg_msg
end
end,
})
minetest.register_chatcommand("all", {
minetest.register_chatcommand("title_all", {
privs = { debug = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
if player then
@ -276,10 +283,25 @@ minetest.register_chatcommand("all", {
mcl_title.set(player, "title", { text = param, color = "gold" })
mcl_title.set(player, "subtitle", { text = param, color = "gold" })
mcl_title.set(player, "actionbar", { text = param, color = "gold" })
return true
return true, dbg_msg
else
return false
return false, dbg_msg
end
end,
})
minetest.register_chatcommand("title_all_styles", {
privs = { debug = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
if player then
mcl_title.params_set(player, { stay = 600 })
mcl_title.set(player, "title", { text = param, color = "gold" })
mcl_title.set(player, "subtitle", { text = param, color = "gold", bold = true })
mcl_title.set(player, "actionbar", { text = param, color = "gold", italic = true })
return true, dbg_msg
else
return false, dbg_msg
end
end,
})
]]