diff --git a/spawn.lua b/spawn.lua index 73761e7..49bc29e 100644 --- a/spawn.lua +++ b/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 })