forked from Mirrorlandia_minetest/mod-sneeker
Do not spawn if spawn cap is reached
This commit is contained in:
parent
398971d08c
commit
d336800b35
10
spawn.lua
10
spawn.lua
@ -42,6 +42,16 @@ minetest.register_abm({
|
|||||||
if minetest.get_node(pos).name ~= 'air' then
|
if minetest.get_node(pos).name ~= 'air' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Get total count of sneekers in world
|
||||||
|
local name, count
|
||||||
|
for name in pairs(minetest.luaentities) do
|
||||||
|
if name == sneeker.mob_name then
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if count >= sneeker.spawn_cap then return end -- Max sneekers already exist
|
||||||
|
|
||||||
minetest.add_entity(pos, sneeker.mob_name)
|
minetest.add_entity(pos, sneeker.mob_name)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user