diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 36cbf2e63..15f935a41 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -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) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 76cf2715d..e80518e48 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -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 diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index 13fc1010e..80f57faa8 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -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