forked from Mirrorlandia_minetest/mod-sneeker
Do not spawn if spawn cap is reached
This commit is contained in:
parent
05670a46c7
commit
1f04669a68
10
spawn.lua
10
spawn.lua
@ -42,6 +42,16 @@ minetest.register_abm({
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
return
|
||||
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)
|
||||
end
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user