1
0
Fork 0
This commit is contained in:
ancientmarinerdev 2023-01-26 16:44:25 +00:00 committed by Gitea
parent 0267ad2f31
commit bd3a4ff0df
1 changed files with 26 additions and 21 deletions

View File

@ -39,6 +39,8 @@ local dbg_spawn_attempts = 0
local dbg_spawn_succ = 0 local dbg_spawn_succ = 0
local dbg_spawn_counts = {} local dbg_spawn_counts = {}
local remove_far = true
local WAIT_FOR_SPAWN_ATTEMPT = 10 local WAIT_FOR_SPAWN_ATTEMPT = 10
local MOB_SPAWN_ZONE_INNER = 24 local MOB_SPAWN_ZONE_INNER = 24
@ -48,8 +50,8 @@ local MOB_SPAWN_ZONE_OUTER = 128 --TODO not used yet. Should replace aoc
-- range for mob count -- range for mob count
local MOB_CAP_INNER_RADIUS = 32 local MOB_CAP_INNER_RADIUS = 32
local aoc_range = 136 local aoc_range = 136
local remove_far = true
local MISSING_CAP_DEFAULT = 15
local MOBS_CAP_CLOSE = 5 local MOBS_CAP_CLOSE = 5
local mob_cap = { local mob_cap = {
@ -716,6 +718,7 @@ if mobs_spawn then
-- Get pos to spawn, x and z are randomised, y is range -- Get pos to spawn, x and z are randomised, y is range
local function mob_cap_space (pos, mob_type, mob_counts_close, mob_counts_wide) local function mob_cap_space (pos, mob_type, mob_counts_close, mob_counts_wide)
--type = "monster", --type = "monster",
@ -729,7 +732,7 @@ if mobs_spawn then
--mcl_log("spawn_class: " .. spawn_class) --mcl_log("spawn_class: " .. spawn_class)
mcl_log("mob_type: " .. mob_type) mcl_log("mob_type: " .. mob_type)
local type_cap = mob_cap[mob_type] or 15 local type_cap = mob_cap[mob_type] or MISSING_CAP_DEFAULT
local close_zone_cap = MOBS_CAP_CLOSE local close_zone_cap = MOBS_CAP_CLOSE
mcl_log("type_cap: " .. type_cap) mcl_log("type_cap: " .. type_cap)
@ -768,9 +771,16 @@ if mobs_spawn then
mcl_log("mob_total_wide: " .. mob_total_wide) mcl_log("mob_total_wide: " .. mob_total_wide)
local mob_count_wide = count_mobs(pos,aoc_range,mob_type) mcl_log("mob_total_close: " .. mob_total_close)
--TODO Remove old checks
local compare_to_old_checks = true
if compare_to_old_checks then
local mob_count_wide = count_mobs(pos,aoc_range,mob_type)
local mob_count_close = count_mobs(pos,MOB_CAP_INNER_RADIUS,mob_type)
mcl_log("old mob_count_wide: " .. mob_count_wide) mcl_log("old mob_count_wide: " .. mob_count_wide)
if mob_total_wide ~= mob_count_wide then if mob_total_wide ~= mob_count_wide then
mcl_log("A difference in wide mob count") mcl_log("A difference in wide mob count")
@ -778,19 +788,14 @@ if mobs_spawn then
mcl_log("No difference in wide mob count") mcl_log("No difference in wide mob count")
end end
mcl_log("mob_total_close: " .. mob_total_close)
local mob_count_close = count_mobs(pos,MOB_CAP_INNER_RADIUS,mob_type)
mcl_log("old mob_count_close: " .. mob_count_close) mcl_log("old mob_count_close: " .. mob_count_close)
if mob_total_close ~= mob_count_close then if mob_total_close ~= mob_count_close then
mcl_log("A difference in close mob count") mcl_log("A difference in close mob count")
else else
mcl_log("No difference in close mob count") mcl_log("No difference in close mob count")
end end
end
--and ( mob_count_wide < (mob_cap[mob_type] or 15) )
--and ( mob_count < 5 )
return cap_space_wide, cap_space_close return cap_space_wide, cap_space_close
end end