From dddaab172cdafbfad84145fa3ecfcb321cf6e9c2 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Mon, 11 Aug 2014 04:35:45 +0400 Subject: [PATCH 1/2] Made missing limbs not process. Moved code in processing so that ORGAN_DESTROYED limbs won't process wounds and chemicals. They still need to process once to actually fall off (too lazy to change that) Made dropping limbs remove all wounds and germs. Instead, one big wound is spawned on parent organ. Damage depends on the organ. Removed missing limbs bleeding on their own, since that's what that wound is for now. They still would ache until surgically mended anyway. Fixed possible issue with amputation not fixing the rotten limb. --- code/modules/organs/blood.dm | 2 -- code/modules/organs/organ_external.dm | 46 +++++++++++++++++---------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/code/modules/organs/blood.dm b/code/modules/organs/blood.dm index 1459098db7..8933427f73 100644 --- a/code/modules/organs/blood.dm +++ b/code/modules/organs/blood.dm @@ -128,8 +128,6 @@ var/const/BLOOD_VOLUME_SURVIVE = 122 continue for(var/datum/wound/W in temp.wounds) if(W.bleeding()) blood_max += W.damage / 4 - if(temp.status & ORGAN_DESTROYED && !(temp.status & ORGAN_GAUZED) && !temp.amputated) - blood_max += 20 //Yer missing a fucking limb. if (temp.open) blood_max += 2 //Yer stomach is cut open drip(blood_max) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index d1bf4f170d..a3b259e3a6 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -155,14 +155,14 @@ // sync the organ's damage with its wounds src.update_damages() - + //If limb took enough damage, try to cut or tear it off if(body_part != UPPER_TORSO && body_part != LOWER_TORSO) //as hilarious as it is, getting hit on the chest too much shouldn't effectively gib you. if(config.limbs_can_break && brute_dam >= max_damage * config.organ_health_multiplier) if( (edge && prob(5 * brute)) || (brute > 20 && prob(2 * brute)) ) droplimb(1) return - + owner.updatehealth() var/result = update_icon() @@ -291,6 +291,8 @@ This function completely restores a damaged organ to perfect condition. //Determines if we even need to process this organ. /datum/organ/external/proc/need_process() + if(destspawn) //Missing limb is missing + return 0 if(status && status != ORGAN_ROBOT) // If it's robotic, that's fine it will have a status. return 1 if(brute_dam || burn_dam) @@ -305,17 +307,6 @@ This function completely restores a damaged organ to perfect condition. return 0 /datum/organ/external/process() - // Process wounds, doing healing etc. Only do this every few ticks to save processing power - if(owner.life_tick % wound_update_accuracy == 0) - update_wounds() - - //Chem traces slowly vanish - if(owner.life_tick % 10 == 0) - for(var/chemID in trace_chemicals) - trace_chemicals[chemID] = trace_chemicals[chemID] - 1 - if(trace_chemicals[chemID] <= 0) - trace_chemicals.Remove(chemID) - //Dismemberment if(status & ORGAN_DESTROYED) if(!destspawn && config.limbs_can_break) @@ -327,6 +318,17 @@ This function completely restores a damaged organ to perfect condition. owner.update_body(1) return + // Process wounds, doing healing etc. Only do this every few ticks to save processing power + if(owner.life_tick % wound_update_accuracy == 0) + update_wounds() + + //Chem traces slowly vanish + if(owner.life_tick % 10 == 0) + for(var/chemID in trace_chemicals) + trace_chemicals[chemID] = trace_chemicals[chemID] - 1 + if(trace_chemicals[chemID] <= 0) + trace_chemicals.Remove(chemID) + //Bone fracurtes if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(status & ORGAN_ROBOT)) src.fracture() @@ -585,13 +587,25 @@ Note that amputating the affected organ does in fact remove the infection from t src.status &= ~ORGAN_BROKEN src.status &= ~ORGAN_BLEEDING src.status &= ~ORGAN_SPLINTED + src.status &= ~ORGAN_DEAD for(var/implant in implants) del(implant) + germ_level = 0 + + //Replace all wounds on that arm with one wound on parent organ. + wounds.Cut() + if (parent) + var/wound_type = get_wound_type(CUT, max_damage) + if(wound_type) + var/datum/wound/W = new wound_type(max_damage) + parent.wounds += W + parent.update_damages() + update_damages() + // If any organs are attached to this, destroy them - for(var/datum/organ/external/O in owner.organs) - if(O.parent == src) - O.droplimb(1) + for(var/datum/organ/external/O in children) + O.droplimb(1) var/obj/organ //Dropped limb object switch(body_part) From 573f49624e97f3410f92f2ddbde1bcb261029e8f Mon Sep 17 00:00:00 2001 From: Chinsky Date: Tue, 12 Aug 2014 19:48:17 +0400 Subject: [PATCH 2/2] Added suggested new type of wounds for stumps --- code/modules/organs/organ_external.dm | 12 ++++--- code/modules/organs/wound.dm | 46 +++++++++++++++++---------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index a3b259e3a6..e1cf22f60e 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -596,11 +596,13 @@ Note that amputating the affected organ does in fact remove the infection from t //Replace all wounds on that arm with one wound on parent organ. wounds.Cut() if (parent) - var/wound_type = get_wound_type(CUT, max_damage) - if(wound_type) - var/datum/wound/W = new wound_type(max_damage) - parent.wounds += W - parent.update_damages() + var/datum/wound/W + if(max_damage < 50) + W = new/datum/wound/lost_limb/small(max_damage) + else + W = new/datum/wound/lost_limb(max_damage) + parent.wounds += W + parent.update_damages() update_damages() // If any organs are attached to this, destroy them diff --git a/code/modules/organs/wound.dm b/code/modules/organs/wound.dm index d20fc0dbfb..383e6be014 100644 --- a/code/modules/organs/wound.dm +++ b/code/modules/organs/wound.dm @@ -31,7 +31,7 @@ var/germ_level = 0 /* These are defined by the wound type and should not be changed */ - + // stages such as "cut", "deep cut", etc. var/list/stages // internal wounds can only be fixed through surgery @@ -51,7 +51,7 @@ // helper lists var/tmp/list/desc_list = list() var/tmp/list/damage_list = list() - + New(var/damage) created = world.time @@ -65,7 +65,7 @@ src.damage = damage max_bleeding_stage = src.desc_list.len - max_bleeding_stage - + // initialize with the appropriate stage src.init_stage(damage) @@ -74,7 +74,7 @@ // returns 1 if there's a next stage, 0 otherwise proc/init_stage(var/initial_damage) current_stage = stages.len - + while(src.current_stage > 1 && src.damage_list[current_stage-1] <= initial_damage / src.amount) src.current_stage-- @@ -84,20 +84,20 @@ // the amount of damage per wound proc/wound_damage() return src.damage / src.amount - + proc/can_autoheal() if(src.wound_damage() <= autoheal_cutoff) return 1 - + return is_treated() - + // checks whether the wound has been appropriately treated proc/is_treated() if(damage_type == BRUISE || damage_type == CUT) return bandaged else if(damage_type == BURN) return salved - + // Checks whether other other can be merged into src. proc/can_merge(var/datum/wound/other) if (other.type != src.type) return 0 @@ -128,10 +128,10 @@ if (disinfected) germ_level = 0 //reset this, just in case return 0 - + if (damage_type == BRUISE && !bleeding()) //bruises only infectable if bleeding return 0 - + var/dam_coef = round(damage/10) switch (damage_type) if (BRUISE) @@ -179,32 +179,32 @@ proc/can_worsen(damage_type, damage) if (src.damage_type != damage_type) return 0 //incompatible damage types - + if (src.amount > 1) return 0 - + //with 1.5*, a shallow cut will be able to carry at most 30 damage, //37.5 for a deep cut //52.5 for a flesh wound, etc. var/max_wound_damage = 1.5*src.damage_list[1] if (src.damage + damage > max_wound_damage) return 0 - + return 1 proc/bleeding() if (src.internal) return 0 // internal wounds don't bleed in the sense of this function - + if (current_stage > max_bleeding_stage) return 0 - + if (bandaged||clamped) return 0 - + if (wound_damage() <= 30 && bleed_timer <= 0) return 0 //Bleed timer has run out. Wounds with more than 30 damage don't stop bleeding on their own. - + return (damage_type == BRUISE && wound_damage() >= 20 || damage_type == CUT && wound_damage() >= 5) /** CUTS **/ @@ -273,3 +273,15 @@ datum/wound/cut/massive stages = list("severed vein" = 30, "cut vein" = 20, "damaged vein" = 10, "bruised vein" = 5) autoheal_cutoff = 5 max_bleeding_stage = 0 //all stages bleed. It's called internal bleeding after all. + +/** EXTERNAL ORGAN LOSS **/ +/datum/wound/lost_limb + damage_type = CUT + stages = list("ripped stump" = 65, "bloody stump" = 50, "clotted stump" = 25, "scarred stump" = 0) + max_bleeding_stage = 3 + + can_merge(var/datum/wound/other) + return 0 //cannot be merged + +/datum/wound/lost_limb/small + stages = list("ripped stump" = 40, "bloody stump" = 30, "clotted stump" = 15, "scarred stump" = 0) \ No newline at end of file