1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-01-09 09:20:21 +01:00

disable node hearing by default

This commit is contained in:
tenplus1 2024-10-10 10:37:47 +01:00
parent 219db764bf
commit a35afc8299
3 changed files with 23 additions and 12 deletions

View File

@ -18,7 +18,7 @@ end
mobs = {
mod = "redo",
version = "20241002",
version = "20241010",
spawning_mobs = {},
translate = S,
invis = minetest.global_exists("invisibility") and invisibility or {},
@ -4737,6 +4737,7 @@ minetest.register_chatcommand("clear_mobs", {
if settings:get_bool("mobs_can_hear") ~= false then
local node_hear = settings:get_bool("mobs_can_hear_node")
local old_sound_play = minetest.sound_play
minetest.sound_play = function(spec, param, eph)
@ -4798,6 +4799,8 @@ if settings:get_bool("mobs_can_hear") ~= false then
end
-- find nodes that can hear up to 8 blocks away
if node_hear then
local dist = min(def.max_hear_distance, 8)
local ps = minetest.find_nodes_in_area(
vector.subtract(def.pos, dist),
@ -4817,6 +4820,7 @@ if settings:get_bool("mobs_can_hear") ~= false then
end
end
end
end
return old_sound_play(spec, param, eph)
end

View File

@ -857,6 +857,10 @@ External Settings for "minetest.conf"
'mob_pathfinding_searchdistance' max search distance from search positions (default 16)
'mob_pathfinding_max_jump' max jump height for pathfinding (default 4)
'mob_pathfinding_max_drop' max drop height for pathfinding (default 6)
'mobs_can_hear' Enabled by default, overrides minetest.sound_play and enables
nearby mobs to run a custom on_sound function.
'mobs_can_hear_node' Disabled by default, allows nearby nodes to hear and run a
custom on_sound function.
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

@ -63,6 +63,9 @@ mob_log_spawn (Log Mob Spawning) bool false
# Mob hearing, when enabled will override minetest.sound_play for mobs to hear
mobs_can_hear (Enable Mob hearing) bool true
# Node hearing, when enabled will allow nodes to hear nearby sounds
mobs_can_hear_node (Enable Node hearing) bool false
[Pathfinding]
# Enable pathfinding (default Enabled)
mob_pathfinding_enable (Enable pathfinding) bool true