From edb1939649c62a2b486e1c04c5af27458f978388 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 22 Apr 2021 00:27:35 -0400 Subject: [PATCH] Fix mob_counter in mob spawning limiter --- mods/ENTITIES/mcl_mobs/api/spawning.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/spawning.lua b/mods/ENTITIES/mcl_mobs/api/spawning.lua index 412fbfc24f..fa900ab00d 100644 --- a/mods/ENTITIES/mcl_mobs/api/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/api/spawning.lua @@ -10,6 +10,7 @@ local max = math.max local get_objects_inside_radius = minetest.get_objects_inside_radius local vector_distance = vector.distance local table_copy = table.copy +local table_remove = table.remove local math_random = math.random -- range for mob count @@ -162,7 +163,7 @@ local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false local count_mobs = function(pos) local num = 0 for _,object in pairs(get_objects_inside_radius(pos, aoc_range)) do - if object and object:get_luaentity() and object.name and object._cmi_is_mob then + if object and object:get_luaentity() and object:get_luaentity()._cmi_is_mob then num = num + 1 end end @@ -569,8 +570,8 @@ if mobs_spawn then break end - --hard code mob limit in area to 10 for now - if count_mobs(spawning_position) >= 10 then + --hard code mob limit in area to 5 for now + if count_mobs(spawning_position) >= 5 then break end @@ -657,7 +658,7 @@ if mobs_spawn then break else --print("deleting temp index") - table.remove(mob_library_worker_table, temp_index) + table_remove(mob_library_worker_table, temp_index) end until repeat_mob_search == false --this is needed to sort through mobs randomly