Do not spawn if spawn cap is reached

This commit is contained in:
AntumDeluge 2017-05-29 00:14:26 -07:00
parent 398971d08c
commit d336800b35

@ -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
})