diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 1b8566827ac..43ea22ccd5c 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -134,23 +134,7 @@ proc handle_health_updates() - // the analgesic effect wears off slowly - analgesic = max(0, analgesic - 1) - - // if the mob has enough health, she should slowly heal - if(stat == 1) - if(health >= 0) - var/pr = 5 - if(stat == 1) // sleeping means faster healing - pr += 5 - if(prob(pr)) - heal_organ_damage(1,1) - adjustToxLoss(-1) - else if(health < 0) - var/pr = 15 - if(prob(pr)) - take_overall_damage(1, 0, used_weapon = "Bloodloss") - else if (stat != 0) + if (stat != 0) if(!lying) lying = 1 //Seriously, stay down :x update_clothing() @@ -869,7 +853,9 @@ return //TODO: DEFERRED - handle_regular_status_updates() + handle_organs() + // take care of organ related updates, such as broken and missing limbs + var/leg_tally = 2 for(var/name in organs) var/datum/organ/external/E = organs[name] @@ -917,11 +903,13 @@ emote("collapse") paralysis = 10 + + handle_blood() + // take care of blood and blood loss + if(stat < 2) var/blood_volume = round(vessel.get_reagent_amount("blood")) - if(bloodloss) - drip(bloodloss) - else if(blood_volume < 560 && blood_volume) + if(blood_volume < 560 && blood_volume) var/datum/reagent/blood/B = locate() in vessel //Grab some blood if(B) // Make sure there's some blood at all if(!B.data["donor"] == src) //If it's not theirs, then we look for theirs @@ -929,10 +917,11 @@ if(D.data["donor"] == src) B = D break + //At this point, we dun care which blood we are adding to, as long as they get more blood. B.volume = max(min(B.volume + 560/blood_volume,560), 0) //Less blood = More blood generated per tick - if(!blood_volume) + if(!blood_volume) // what is this for? if their blood_volume is 0, they'll die anyway bloodloss = 0 else if(blood_volume > 448) if(pale) @@ -953,13 +942,23 @@ update_body() eye_blurry += 6 if(prob(15)) - paralysis += rand(1,3) + Paralyse(rand(1,3)) else if(blood_volume <= 244 && blood_volume > 122) if(toxloss <= 100) toxloss = 100 else if(blood_volume <= 122) death() + + handle_regular_status_updates() + // take care of misc. things related to health + + // the analgesic effect wears off slowly + analgesic = max(0, analgesic - 1) + + handle_organs() + handle_blood() + updatehealth() if(getOxyLoss() > 50) Paralyse(3) @@ -969,7 +968,6 @@ else if(health < config.health_threshold_crit) if(health <= 20 && prob(1)) spawn(0) emote("gasp") - //if(!rejuv) oxyloss++ if(!reagents.has_reagent("inaprovaline")) adjustOxyLoss(1) if(stat != 2) stat = 1 @@ -1051,13 +1049,10 @@ var/datum/organ/external/temp = organs[name] if(!temp.bleeding || temp.robot) //THAT WAS DUMB. continue - // else - // if(prob(35)) - // bloodloss += rand(1,10) - if(temp.wounds) - for(var/datum/organ/wound/W in temp.wounds) - if(W.wound_size && W.bleeding) - blood_max += W.wound_size + var/lose_blood = temp.total_wound_bleeding() + if(lose_blood) + drip(lose_blood) + blood_max += lose_blood if(temp.destroyed && !temp.gauzed) blood_max += 10 //Yer missing a fucking limb. bloodloss = min(bloodloss+1,sqrt(blood_max)) diff --git a/code/modules/mob/organ/organ.dm b/code/modules/mob/organ/organ.dm index 5d992667129..4070542e6c7 100644 --- a/code/modules/mob/organ/organ.dm +++ b/code/modules/mob/organ/organ.dm @@ -82,6 +82,18 @@ del(W) ..() + proc/total_wound_bleeding() + // Get the total amount and size of bleeding wounds + var/rval = 0 + + for(var/datum/organ/wound/W in wounds) if(W.bleeding) + rval += W.wound_size + + // bandages reduce bleeding + if(bandaged) return rval / 8 + + return rval + proc/take_damage(brute, burn, sharp, used_weapon = null, spread=0) if((brute <= 0) && (burn <= 0)) return 0 @@ -411,9 +423,8 @@ if(hasorgans(owner)) if(!possible_wounds.len || prob(20)) var/datum/organ/wound/W = new(src) - bleeding = max(!type,bleeding) //Sharp objects cause bleeding. - W.bleeding = !type - // owner:bloodloss += 10 * size + W.bleeding = !type || (size > 2) // large wounds always cause bleeding + W.damage = damage W.initial_dmg = damage W.wound_type = type @@ -429,7 +440,7 @@ var/datum/organ/wound/W = pick(possible_wounds) bleeding = max(!type,bleeding) //Sharp objects cause bleeding. W.bleeding = max(!type,W.bleeding) - // owner:bloodloss += 10 * size + W.damage += damage W.initial_dmg += damage W.wound_size = max(1,min(6,round(W.damage/10) + rand(0,1)))