From d1932f70458b1967d98135316642f0f0c8de55c3 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Tue, 24 Jun 2014 04:09:35 +0400 Subject: [PATCH] Moved same code into single organ helper to handle embedding. Conflicts: code/modules/mob/living/carbon/human/human_damage.dm code/modules/mob/living/carbon/human/human_defense.dm code/modules/organs/organ_external.dm --- .../mob/living/carbon/human/human_damage.dm | 19 +++----- .../mob/living/carbon/human/human_defense.dm | 7 +-- code/modules/organs/organ_external.dm | 44 ++++++++++++------- .../reagent_containers/food/snacks.dm | 7 +-- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 9665bda7ab3..d6429705809 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -66,13 +66,13 @@ if (organ_name in organs_by_name) var/datum/organ/external/O = get_organ(organ_name) - + if(amount > 0) O.take_damage(amount, 0, sharp=is_sharp(damage_source), edge=has_edge(damage_source), used_weapon=damage_source) else //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. O.heal_damage(-amount, 0, internal=0, robo_repair=(O.status & ORGAN_ROBOT)) - + hud_updateflag |= 1 << HEALTH_HUD /mob/living/carbon/human/proc/adjustFireLossByPart(var/amount, var/organ_name, var/obj/damage_source = null) @@ -81,13 +81,13 @@ if (organ_name in organs_by_name) var/datum/organ/external/O = get_organ(organ_name) - + if(amount > 0) O.take_damage(0, amount, sharp=is_sharp(damage_source), edge=has_edge(damage_source), used_weapon=damage_source) else //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. O.heal_damage(0, -amount, internal=0, robo_repair=(O.status & ORGAN_ROBOT)) - + hud_updateflag |= 1 << HEALTH_HUD /mob/living/carbon/human/Stun(amount) @@ -313,15 +313,8 @@ This function restores all organs. if(istype(used_weapon,/obj/item/weapon)) var/obj/item/weapon/W = used_weapon //Sharp objects will always embed if they do enough damage. if( (damage > (10*W.w_class)) && ( (sharp && !ismob(W.loc)) || prob(damage/W.w_class) ) ) - organ.implants += W - visible_message("\The [W] sticks in the wound!") - embedded_flag = 1 - src.verbs += /mob/proc/yank_out_object - W.add_blood(src) - if(ismob(W.loc)) - var/mob/living/H = W.loc - H.drop_item() - W.loc = src + organ.embed(W) + return 1 diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 3a88bba28a9..26ebac25329 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -99,11 +99,8 @@ emp_act (SP.name) = "[P.name] shrapnel" (SP.desc) = "[SP.desc] It looks like it was fired from [P.shot_from]." (SP.loc) = organ - organ.implants += SP - visible_message("The projectile sticks in the wound!") - embedded_flag = 1 - src.verbs += /mob/proc/yank_out_object - SP.add_blood(src) + organ.embed(SP) + return (..(P , def_zone)) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index d691a079c33..4bbfcd851a8 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -339,7 +339,7 @@ This function completely restores a damaged organ to perfect condition. //Updating germ levels. Handles organ germ levels and necrosis. /* -The INFECTION_LEVEL values defined in setup.dm control the time it takes to reach the different +The INFECTION_LEVEL values defined in setup.dm control the time it takes to reach the different infection levels. Since infection growth is exponential, you can adjust the time it takes to get from one germ_level to another using the rough formula: @@ -351,10 +351,10 @@ the actual time is dependent on RNG. INFECTION_LEVEL_ONE below this germ level nothing happens, and the infection doesn't grow INFECTION_LEVEL_TWO above this germ level the infection will start to spread to internal and adjacent organs -INFECTION_LEVEL_THREE above this germ level the player will take additional toxin damage per second, and will die in minutes without +INFECTION_LEVEL_THREE above this germ level the player will take additional toxin damage per second, and will die in minutes without antitox. also, above this germ level you will need to overdose on spaceacillin to reduce the germ_level. -Note that amputating the affected organ does in fact remove the infection from the +Note that amputating the affected organ does in fact remove the infection from the player's body, though, antitox and spaceacillin are easy enough to get I doubt it will ever be needed. */ /datum/organ/external/proc/update_germs() @@ -369,7 +369,7 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i //Open wounds can become infected if (owner.germ_level > W.germ_level && W.infection_check()) W.germ_level++ - + //Infected wounds raise the organ's germ level W.germ_level = max(W.germ_level, germ_level) //Wounds get all the germs if (W.germ_level > germ_level) //Badly infected wounds raise internal germ levels @@ -378,41 +378,41 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin") if (germ_level > 0 && antibiotics > 5) if (prob(4*antibiotics)) germ_level-- //the higher the germ level the more antibiotics you'll need. - + if(germ_level >= INFECTION_LEVEL_ONE) //having an infection raises your body temperature var/fever_temperature = (owner.species.heat_level_1 - owner.species.body_temperature - 1)* min(germ_level/INFECTION_LEVEL_THREE, 1) + owner.species.body_temperature if (owner.bodytemperature < fever_temperature) //world << "fever: [owner.bodytemperature] < [fever_temperature], raising temperature." owner.bodytemperature++ - + if(prob(round(germ_level/10))) germ_level++ if (prob(5)) //adjust this to tweak how fast people take toxin damage from infections owner.adjustToxLoss(1) - + if(germ_level >= INFECTION_LEVEL_TWO) //spread the infection for (var/datum/organ/internal/I in internal_organs) if (I.germ_level < germ_level) I.germ_level++ - + if (children) //To child organs 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)) child.germ_level++ - + if (parent) if (parent.germ_level < germ_level && !(parent.status & ORGAN_ROBOT)) if (parent.germ_level < INFECTION_LEVEL_ONE*2 || prob(30)) parent.germ_level++ - + if(germ_level >= INFECTION_LEVEL_THREE && antibiotics < 30) //overdosing is necessary to stop severe infections if (!(status & ORGAN_DEAD)) status |= ORGAN_DEAD owner << "You can't feel your [display_name] anymore..." - + germ_level++ owner.adjustToxLoss(1) @@ -789,7 +789,7 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i /datum/organ/external/proc/process_grasp(var/obj/item/c_hand, var/hand_name) if (!c_hand) return - + if(is_broken()) owner.u_equip(c_hand) var/emote_scream = pick("screams in pain and", "lets out a sharp cry and", "cries out and") @@ -804,6 +804,18 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i spawn(10) del(spark_system) +/datum/organ/external/proc/embed(var/obj/item/weapon/W, var/silent = 0) + if(!silent) + owner.visible_message("\The [W] sticks in the wound!") + implants += W + owner.embedded_flag = 1 + owner.verbs += /mob/proc/yank_out_object + W.add_blood(owner) + if(ismob(W.loc)) + var/mob/living/H = W.loc + H.drop_item() + W.loc = owner + /**************************************************** ORGAN DEFINES @@ -833,7 +845,7 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i max_damage = 50 min_broken_damage = 20 body_part = ARM_LEFT - + process() ..() process_grasp(owner.l_hand, "left hand") @@ -854,7 +866,7 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i max_damage = 50 min_broken_damage = 20 body_part = ARM_RIGHT - + process() ..() process_grasp(owner.r_hand, "right hand") @@ -893,7 +905,7 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i max_damage = 30 min_broken_damage = 15 body_part = HAND_RIGHT - + process() ..() process_grasp(owner.r_hand, "right hand") @@ -905,7 +917,7 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i max_damage = 30 min_broken_damage = 15 body_part = HAND_LEFT - + process() ..() process_grasp(owner.l_hand, "left hand") diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index f73334ef5c0..d2272c485d4 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -1642,7 +1642,7 @@ surprise.icon_state = "skrellkey1" specie = "neaera" surprise.name = "malformed [specie]" - surprise.desc = "Looks like \a very deformed [specie], a little small for its kind." + surprise.desc = "Looks like \a very deformed [specie], a little small for its kind. It shows no signs of life." surprise.transform *= 0.6 surprise.add_blood(M) @@ -1658,10 +1658,7 @@ E.cavity = 0 else //someone is having a bad day E.createwound(CUT, 30) - E.implants += surprise - H.visible_message("Something that looks like \a [surprise] sticks out of a wound!") - H.embedded_flag = 1 - H.verbs += /mob/proc/yank_out_object + E.embed(surprise) else if (ismonkey(M)) M.visible_message("[M] suddenly tears in half!") surprise.loc = M.loc