1
0
Fork 0

Add setting to disable mob spawning

This commit is contained in:
Wuzzy 2018-01-25 04:51:22 +01:00
parent b9686c2d9f
commit 70ea7d71ad
2 changed files with 12 additions and 2 deletions

View File

@ -54,6 +54,7 @@ end
-- Load settings -- Load settings
local damage_enabled = minetest.settings:get_bool("enable_damage") local damage_enabled = minetest.settings:get_bool("enable_damage")
local peaceful_only = minetest.settings:get_bool("only_peaceful_mobs") 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 disable_blood = minetest.settings:get_bool("mobs_disable_blood")
local creative = minetest.settings:get_bool("creative_mode") local creative = minetest.settings:get_bool("creative_mode")
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false 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, catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider) 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] if not mobs.spawning_mobs[name]
or not minetest.registered_entities[name] then or not minetest.registered_entities[name] then
--print ("--- mob doesn't exist", name) --print ("--- mob doesn't exist", name)

View File

@ -33,8 +33,13 @@ mcl_showDeathMessages (Show death messages) bool true
# If enabled, the weather will change naturally over time. # If enabled, the weather will change naturally over time.
mcl_doWeatherCycle (Change weather) bool true 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 # If enabled, only peaceful mobs will appear naturally. This does not
# affect monster spawners. # affect mob spawners.
# This setting is only read at startup. # This setting is only read at startup.
only_peaceful_mobs (Spawn only peaceful mobs) bool false only_peaceful_mobs (Spawn only peaceful mobs) bool false