More useful responses in chat commands
This commit is contained in:
parent
d18d442d6e
commit
e2c0f6f682
|
@ -205,7 +205,7 @@ minetest.register_on_dieplayer(on_dieplayer)
|
|||
minetest.register_chatcommand(
|
||||
"player_effects",
|
||||
{
|
||||
description = "Show current player effects",
|
||||
description = "Show your current player effects",
|
||||
func = function(name, param)
|
||||
local s = "Current player effects:\n"
|
||||
local ea = 0
|
||||
|
@ -221,9 +221,9 @@ minetest.register_chatcommand(
|
|||
end
|
||||
|
||||
if ea > 0 then
|
||||
minetest.chat_send_player(name, s)
|
||||
return true, s
|
||||
else
|
||||
minetest.chat_send_player(name, "You currently have no effects")
|
||||
return true, "You currently have no effects."
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
@ -107,6 +107,7 @@ minetest.register_chatcommand(
|
|||
else
|
||||
minetest.chat_send_player(player_name, player_count .. " connected players")
|
||||
end
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
@ -205,15 +205,11 @@ minetest.register_chatcommand(
|
|||
func = function(name, param)
|
||||
if is_valid_skin(param) then
|
||||
player_skins.set_skin(name, param)
|
||||
return true, string.format("Skin set to “%s”.", param)
|
||||
elseif param == "" then
|
||||
minetest.chat_send_player(
|
||||
name,
|
||||
"Current player skin: " .. player_skins.skins[name])
|
||||
return true, "Current player skin: " .. player_skins.skins[name]
|
||||
else
|
||||
minetest.chat_send_player(
|
||||
name,
|
||||
"Bad param for /player_skin; type /help player_skin"
|
||||
)
|
||||
return false, "Unknown player skin. Enter “/help player_skin” for help."
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
@ -69,6 +69,9 @@ function setweather_type(type)
|
|||
if valid then
|
||||
weather.weather = type
|
||||
play_sound()
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -201,18 +204,23 @@ minetest.register_globalstep(
|
|||
minetest.register_privilege(
|
||||
"weather",
|
||||
{
|
||||
description = "Can use /weather command",
|
||||
description = "Can change the weather using the /weather command",
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
|
||||
minetest.register_chatcommand(
|
||||
"weather",
|
||||
{
|
||||
params = "[storm|snowstorm|clear]",
|
||||
description = "Set the weather to either clear, storm, or snowstorm",
|
||||
params = "storm | snowstorm | clear",
|
||||
description = "Change the weather",
|
||||
privs = {weather = true},
|
||||
func = function(name, param)
|
||||
setweather_type(param)
|
||||
local weather_set = setweather_type(param)
|
||||
if not weather_set then
|
||||
return false, "Incorrect weather. Valid weathers are “storm”, “snowstorm” and “clear”."
|
||||
else
|
||||
return true, "Weather changed."
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue