This commit is contained in:
teknomunk 2024-09-13 17:36:19 -05:00
parent 6c50e0a82b
commit e65370b845
3 changed files with 2 additions and 6 deletions

@ -48,7 +48,7 @@ function table.pairs_by_keys(t, f)
return iter
end
local function table.pull_random_items(table)
function table.pull_random_items(table)
local count = #table
return function()
local idx = math.random(count)

@ -1055,7 +1055,6 @@ local function summon_golem(self)
local nn = minetest.find_nodes_in_area_under_air(p1, p2,{"group:solid","group:water"})
for n in table.pull_random_items(nn) do
n.y = n.y + 1
minetest.log("trying to summon golem at "..vector.to_string(n))
local summon = mcl_mobs.spawn(n, "mobs_mc:iron_golem")
if summon then

@ -230,9 +230,7 @@ local function spawn_mobs(pos, elapsed)
local mlig = meta:get_int("MinLight")
local xlig = meta:get_int("MaxLight")
for pos2 = table.pull_random_items(air) do
local pos2 = air[air_index]
for pos2 in table.pull_random_items(air) do
-- only if light levels are within range
local lig = minetest.get_node_light(pos2) or 0
if lig >= mlig and lig <= xlig then
@ -241,7 +239,6 @@ local function spawn_mobs(pos, elapsed)
if num_to_spawn == 0 then break end
end
end
table.remove(air, air_index)
end
end