1
0
mirror of https://codeberg.org/tenplus1/mobs_animal.git synced 2024-12-23 01:10:25 +01:00

add herd node check

This commit is contained in:
tenplus1 2022-10-11 12:05:56 +01:00
parent ca6ff68c3a
commit 848622ccde

View File

@ -266,11 +266,17 @@ if not mobs.custom_spawn_animal then
for n = 1, iter do for n = 1, iter do
-- 1/8 chance of black sheep, 1/4 chance of baby sheep -- 1/8 chance of black sheep, 1/4 chance of baby sheep
local pos2 = nods[random(#nods)] ; pos2.y = pos2.y + 1.5 local pos2 = nods[random(#nods)]
local type = random(8) == 1 and "_black" or "_white" local type = random(8) == 1 and "_black" or "_white"
local kid = random(4) == 1 and true or nil local kid = random(4) == 1 and true or nil
mobs:add_mob(pos2, {name = "mobs_animal:sheep" .. type, child = kid}) pos2.y = pos2.y + 2
if minetest.get_node(pos2).name == "air" then
mobs:add_mob(pos2, {
name = "mobs_animal:sheep" .. type, child = kid})
end
end end
end end
end end