diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index db9107a3b85..7614a6eaaa8 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -407,8 +407,8 @@ Note that amputating the affected organ does in fact remove the infection from t owner.adjustToxLoss(1) if(germ_level >= INFECTION_LEVEL_TWO && antibiotics < 5) - //spread the infection - var/datum/organ/internal/target_organ //make internal organs become infected one at a time instead of all at once + //spread the infection to internal organs + var/datum/organ/internal/target_organ = null //make internal organs become infected one at a time instead of all at once for (var/datum/organ/internal/I in internal_organs) if (I.germ_level > 0 && I.germ_level < min(germ_level, INFECTION_LEVEL_TWO)) //once the organ reaches whatever we can give it, or level two, switch to a different one if (!target_organ || I.germ_level > target_organ.germ_level) //choose the organ with the highest germ_level @@ -420,11 +420,14 @@ Note that amputating the affected organ does in fact remove the infection from t for (var/datum/organ/internal/I in internal_organs) if (I.germ_level < germ_level) candidate_organs += I - target_organ = pick(candidate_organs) + if (candidate_organs.len) + target_organ = pick(candidate_organs) - target_organ.germ_level++ + if (target_organ) + target_organ.germ_level++ - if (children) //To child organs + //spread the infection to child and parent organs + if (children) for (var/datum/organ/external/child in children) if (child.germ_level < germ_level && !(child.status & ORGAN_ROBOT)) if (child.germ_level < INFECTION_LEVEL_ONE*2 || prob(30))