123456789101112131415161718192021222324252627282930 |
- local S = minetest.get_translator("mob_spawning_director")
- minetest.register_chatcommand("mobspawning",
- {
- params = "[on|off]",
- privs = {server = true},
- description = S("Toggles mob spawning on or off"),
- func = function(name, param)
-
- local on = mob_spawning_director.get_enablation_state()
-
- if param == "on" and not on
- then
- mob_spawning_director.enable()
- return true, S("Enabled mob spawning")
-
- elseif param == "off" and on
- then
- mob_spawning_director.disable()
- return true, S("Disabled mob spawning")
-
- elseif (param == "on" and on) or (param == "off" and not on)
- then
- return true, S("Mob spawning was already " .. (on and "enabled" or "disabled"))
- else
- return true, S("Mob spawning is " .. (on and "enabled" or "disabled"))
- end
- end,
- })
|