Add setting for mob-movement stop range

This commit is contained in:
cora 2022-11-03 00:49:23 +01:00
parent b144a93fd8
commit da9f253117
2 changed files with 9 additions and 1 deletions

@ -18,7 +18,10 @@ local PATHFINDING = "gowp"
-- Localize -- Localize
local S = minetest.get_translator("mcl_mobs") local S = minetest.get_translator("mcl_mobs")
local mob_active_range = tonumber(minetest.settings:get("mcl_mob_active_range")) or 48
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_mobs_villager",false) local LOGGING_ON = minetest.settings:get_bool("mcl_logging_mobs_villager",false)
local LOG_MODULE = "[Mobs]" local LOG_MODULE = "[Mobs]"
local function mcl_log (message) local function mcl_log (message)
if LOGGING_ON and message then if LOGGING_ON and message then
@ -216,7 +219,7 @@ end
local function player_in_active_range(self) local function player_in_active_range(self)
for _,p in pairs(minetest.get_connected_players()) do for _,p in pairs(minetest.get_connected_players()) do
if vector.distance(self.object:get_pos(),p:get_pos()) <= 38 then return true end if vector.distance(self.object:get_pos(),p:get_pos()) <= mob_active_range then return true end
-- slightly larger than the mc 32 since mobs spawn on that circle and easily stand still immediately right after spawning. -- slightly larger than the mc 32 since mobs spawn on that circle and easily stand still immediately right after spawning.
end end
end end

@ -127,6 +127,11 @@ mcl_mob_cap_ambient (Mob cap ambient mobs) int 15 0 1024
#Display mob icons in inventory instead of mc-like spawn eggs #Display mob icons in inventory instead of mc-like spawn eggs
mcl_old_spawn_icons (Old spawn icons instead of eggs) bool false mcl_old_spawn_icons (Old spawn icons instead of eggs) bool false
# How far from players should mobs stop moving
# Larger values will have a larger performance impact (default:48)
mcl_mob_active_range (Active mob range) int 48 0 256
[Audio] [Audio]
# Enable flame sound. # Enable flame sound.
flame_sound (Flame sound) bool true flame_sound (Flame sound) bool true