1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-07-01 07:50:23 +02:00

add mob repellent

This commit is contained in:
tenplus1
2025-02-09 12:12:52 +00:00
parent 9f472fb690
commit 0a62f05132
6 changed files with 28 additions and 4 deletions

11
api.lua
View File

@ -18,7 +18,7 @@ end
-- Global table
mobs = {
mod = "redo", version = "20250204",
mod = "redo", version = "20250209",
spawning_mobs = {}, translate = S,
node_snow = has(minetest.registered_aliases["mapgen_snow"])
or has("mcl_core:snow") or has("default:snow") or "air",
@ -3717,6 +3717,15 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
end
end
-- is mob repellent nearby
if #minetest.find_nodes_in_area(
{x = pos.x - 16, y = pos.y - 16, z = pos.z - 16},
{x = pos.x + 16, y = pos.y + 16, z = pos.z + 16},
{"mobs:mob_repellent"}) > 0 then
--print("--- mob repellent nearby")
return
end
-- change position to node above
pos.y = pos.y + 1