check if weather is registered
This commit is contained in:
parent
3ec25f8eee
commit
0c60ce470f
|
@ -7,20 +7,24 @@ minetest.register_privilege("weather", {
|
||||||
minetest.register_chatcommand("setweather", {
|
minetest.register_chatcommand("setweather", {
|
||||||
params = "<weather>",
|
params = "<weather>",
|
||||||
description = "Set weather to a registered type of downfall\
|
description = "Set weather to a registered type of downfall\
|
||||||
show all types when nor parameters are given", -- full description
|
show all types when no parameters are given", -- full description
|
||||||
privs = {weather = true},
|
privs = {weather = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == nil or param == "" then
|
if param == nil or param == "" or param == "?" then
|
||||||
local types="none"
|
local types="none"
|
||||||
for i,_ in pairs(weather_mod.registered_downfalls) do
|
for i,_ in pairs(weather_mod.registered_downfalls) do
|
||||||
types=types..", "..i
|
types=types..", "..i
|
||||||
end
|
end
|
||||||
minetest.chat_send_player(name, "avalible weather types: "..types)
|
minetest.chat_send_player(name, "avalible weather types: "..types)
|
||||||
|
else
|
||||||
|
if weather_mod.registered_downfalls[param] == nil then
|
||||||
|
minetest.chat_send_player(name, "This type of weather is not registered. To list all types of weather run the command without parameters.")
|
||||||
else
|
else
|
||||||
weather.type = param
|
weather.type = param
|
||||||
weather_mod.handle_lightning()
|
weather_mod.handle_lightning()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Set weather
|
-- Set weather
|
||||||
|
|
Loading…
Reference in New Issue