Merge pull request 'Add setting for mob-movement stop range' (#2896) from mob_move_setting into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2896
This commit is contained in:
cora 2022-11-03 13:34:31 +00:00
commit 06d4845955
2 changed files with 9 additions and 1 deletions

View File

@ -18,7 +18,10 @@ local PATHFINDING = "gowp"
-- Localize
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 LOG_MODULE = "[Mobs]"
local function mcl_log (message)
if LOGGING_ON and message then
@ -216,7 +219,7 @@ end
local function player_in_active_range(self)
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.
end
end

View File

@ -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
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]
# Enable flame sound.
flame_sound (Flame sound) bool true