Limit casket spawns.

This commit is contained in:
Duane 2016-07-03 04:36:54 -05:00
parent 6286a4e829
commit 801b11bf67
2 changed files with 22 additions and 11 deletions

View file

@ -302,7 +302,19 @@ minetest.register_abm({
nodenames = {"fun_caves:casket"},
interval = 2,
chance = 10,
action = function(pos, node)
catch_up = false,
action = function(pos, node, aoc, active_object_count_wider)
-- do not spawn if too many active entities in area
if active_object_count_wider > 5 then
return
end
local meta = minetest.get_meta(pos)
local ready = meta:get_string('formspec')
if ready ~= '' then
return
end
local objs = minetest.get_objects_inside_radius(pos, 7)
for i = 1, #objs do
if objs[i]:is_player() then