From ca8f78cec8893d7fabbf13b07234c875fdd348ca Mon Sep 17 00:00:00 2001 From: BlockMen Date: Mon, 21 Jul 2014 23:49:09 +0200 Subject: [PATCH] More spawning fixes --- init.lua | 12 +++++------- spawn.lua | 5 ++++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 766eb70..2fecc84 100644 --- a/init.lua +++ b/init.lua @@ -59,13 +59,11 @@ function creatures.spawn(pos, number, mob, limit, range, abs_max) local z = 1/math.random(1,3) local p = {x=pos.x+x,y=pos.y,z=pos.z+z} if mobs+i <= limit and spawned+i < abs_max then - minetest.after(i/5,function() - local obj = minetest.add_entity(p, mob) - if obj then - creatures.spawned[m_name] = spawned + 1 - minetest.log("action", "Spawned "..mob.." at ("..pos.x..","..pos.y..","..pos.z..")") - end - end) + local obj = minetest.add_entity(p, mob) + if obj then + creatures.spawned[m_name] = spawned + 1 + minetest.log("action", "Spawned "..mob.." at ("..pos.x..","..pos.y..","..pos.z..")") + end end end end diff --git a/spawn.lua b/spawn.lua index 52f66ba..3dd4673 100644 --- a/spawn.lua +++ b/spawn.lua @@ -4,6 +4,7 @@ if not minetest.setting_getbool("only_peaceful_mobs") then -- zombie minetest.register_abm({ nodenames = creatures.z_spawn_nodes, + neighbors = {"air"}, interval = 40.0, chance = 7600, action = function(pos, node, active_object_count, active_object_count_wider) @@ -37,6 +38,7 @@ if not minetest.setting_getbool("only_peaceful_mobs") then -- ghost minetest.register_abm({ nodenames = creatures.g_spawn_nodes, + neighbors = {"air"}, interval = 44.0, chance = 8350, action = function(pos, node, active_object_count, active_object_count_wider) @@ -75,6 +77,7 @@ end -- peaceful minetest.register_abm({ nodenames = creatures.s_spawn_nodes, + neighbors = {"air"}, interval = 55.0, chance = 7800, action = function(pos, node, active_object_count, active_object_count_wider) @@ -94,5 +97,5 @@ minetest.register_abm({ return end if math.random(1,10) > 8 then return end - creatures.spawn(pos, math.random(1,2), "creatures:sheep", 4, 50) + creatures.spawn(pos, math.random(1,2), "creatures:sheep", 4, 50, 30) end})