From 70ea7d71ad310e10f81bab61d7db4dfbdc29aff8 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 25 Jan 2018 04:51:22 +0100 Subject: [PATCH] Add setting to disable mob spawning --- mods/ENTITIES/mobs/api.lua | 7 ++++++- settingtypes.txt | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs/api.lua b/mods/ENTITIES/mobs/api.lua index 1c1b9d5031..17a9d78758 100644 --- a/mods/ENTITIES/mobs/api.lua +++ b/mods/ENTITIES/mobs/api.lua @@ -54,6 +54,7 @@ end -- Load settings local damage_enabled = minetest.settings:get_bool("enable_damage") local peaceful_only = minetest.settings:get_bool("only_peaceful_mobs") +local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) local disable_blood = minetest.settings:get_bool("mobs_disable_blood") local creative = minetest.settings:get_bool("creative_mode") local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false @@ -2860,8 +2861,12 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, catch_up = false, action = function(pos, node, active_object_count, active_object_count_wider) + -- Can mobs spawn at all? + if not mobs_spawn then + return + end - -- is mob actually registered? + -- Is mob actually registered? if not mobs.spawning_mobs[name] or not minetest.registered_entities[name] then --print ("--- mob doesn't exist", name) diff --git a/settingtypes.txt b/settingtypes.txt index 56dd867549..69220c5e39 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -33,8 +33,13 @@ mcl_showDeathMessages (Show death messages) bool true # If enabled, the weather will change naturally over time. mcl_doWeatherCycle (Change weather) bool true +# If enabled, mobs will spawn naturally. This does not affect +# affect mob spawners. +# This setting is only read at startup. +mobs_spawn (Spawn mobs naturally) bool true + # If enabled, only peaceful mobs will appear naturally. This does not -# affect monster spawners. +# affect mob spawners. # This setting is only read at startup. only_peaceful_mobs (Spawn only peaceful mobs) bool false