diff --git a/code/modules/cm_aliens/structures/special/pylon_core.dm b/code/modules/cm_aliens/structures/special/pylon_core.dm index 3fafdb8e2176..47654bf20bce 100644 --- a/code/modules/cm_aliens/structures/special/pylon_core.dm +++ b/code/modules/cm_aliens/structures/special/pylon_core.dm @@ -135,6 +135,9 @@ structure.activated = TRUE addtimer(CALLBACK(structure, PROC_REF(give_larva)), XENO_PYLON_ACTIVATION_COOLDOWN, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_LOOP|TIMER_DELETE_ME) +#define ENDGAME_LARVA_CAP_MULTIPLIER 0.4 +#define LARVA_ADDITION_MULTIPLIER 0.05 + /// Looped proc via timer to give larva after time /obj/effect/alien/resin/special/pylon/endgame/proc/give_larva() if(!activated) @@ -143,9 +146,22 @@ if(!linked_hive.hive_location || !linked_hive.living_xeno_queen) return - linked_hive.stored_larva++ + var/list/hive_xenos = linked_hive.totalXenos + + for(var/mob/living/carbon/xenomorph/xeno in hive_xenos) + if(!xeno.counts_for_slots) + hive_xenos -= xeno + + if(length(hive_xenos) > (length(GLOB.alive_human_list) * ENDGAME_LARVA_CAP_MULTIPLIER)) + return + + linked_hive.partial_larva += length(hive_xenos) * LARVA_ADDITION_MULTIPLIER + linked_hive.convert_partial_larva_to_full_larva() linked_hive.hive_ui.update_burrowed_larva() +#undef ENDGAME_LARVA_CAP_MULTIPLIER +#undef LARVA_ADDITION_MULTIPLIER + //Hive Core - Generates strong weeds, supports other buildings /obj/effect/alien/resin/special/pylon/core name = XENO_STRUCTURE_CORE diff --git a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm index ab5028b12844..2efbdb38eb88 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -1114,6 +1114,10 @@ /datum/hive_status/proc/increase_larva_after_burst() var/extra_per_burst = CONFIG_GET(number/extra_larva_per_burst) partial_larva += extra_per_burst + convert_partial_larva_to_full_larva() + +///Called after times when partial larva are added to process them to stored larva +/datum/hive_status/proc/convert_partial_larva_to_full_larva() for(var/i = 1 to partial_larva) partial_larva-- stored_larva++