added 'mob_nospawn_range' setting

This commit is contained in:
TenPlus1 2020-05-01 19:30:29 +01:00
parent 928f8c5479
commit f98d769e15
4 changed files with 9 additions and 3 deletions

View File

@ -52,6 +52,7 @@ local remove_far = minetest.settings:get_bool("remove_far_mobs") ~= false
local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0
local show_health = minetest.settings:get_bool("mob_show_health") ~= false
local max_per_block = tonumber(minetest.settings:get("max_objects_per_block") or 99)
local mob_nospawn_range = tonumber(minetest.settings:get("mob_nospawn_range") or 12)
local mob_chance_multiplier = tonumber(minetest.settings:get("mob_chance_multiplier") or 1)
-- Peaceful mode message so players will know there are no monsters
@ -3654,8 +3655,9 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
return
end
-- only spawn away from player
local objs = minetest.get_objects_inside_radius(pos, 12)
-- only spawn a set distance away from player
local objs = minetest.get_objects_inside_radius(
pos, mob_nospawn_range)
for n = 1, #objs do

View File

@ -632,6 +632,7 @@ External Settings for "minetest.conf"
'mobs_griefing' when false mobs cannot break blocks when using either
pathfinding level 2, replace functions or mobs:boom
function.
'mob_nospawn_range' Minimum range a mob can spawn near player (def: 12)
Players can override the spawn chance for each mob registered by adding a line
to their minetest.conf file with a new value, the lower the value the more each

View File

@ -23,7 +23,7 @@ Lucky Blocks: 9
Changelog:
- 1.51 - Added some node checks for dangerous nodes, jumping and falling tweaks, spawn area check (thx for idea wuzzy), re-enabled mob suffocation
- 1.51 - Added some node checks for dangerous nodes, jumping and falling tweaks, spawn area check (thx for idea wuzzy), re-enabled mob suffocation, add 'mob_nospawn_range' setting
- 1.50 - Added new line_of_sight function that uses raycasting if mt5.0 is found, (thanks Astrobe), dont spawn mobs if world anchor nearby (technic or simple_anchor mods), chinese local added
- 1.49- Added mobs:force_capture(self, player) function, api functions now use metatables thanks to bell07
- 1.48- Add mobs:set_velocity(self, velocity) global function

View File

@ -27,3 +27,6 @@ mob_chance_multiplier (Mob chance multiplier) float 1.0
# When false Mob no longer drop items when killed
mobs_drop_items (Mob drops) bool true
#....Sets minimum distance around player that mobs cannot spawn
mob_nospawn_range (Mob no-spawn range) float 12.0