From 7889ac25abc1d107a91205ba516ddba941da8b8d Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Tue, 1 Jul 2014 10:12:58 +0930 Subject: [PATCH] Fixed embedding. --- .../mob/living/carbon/human/human_damage.dm | 8 ++--- code/modules/mob/living/living_defense.dm | 9 +++-- code/modules/organs/organ_external.dm | 36 ++++++++++--------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 086b098999..e03f240a88 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -297,11 +297,11 @@ This function restores all organs. updatehealth() hud_updateflag |= 1 << HEALTH_HUD - //Embedded projectile code. + //Embedded object code. if(!organ) return - 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) ) ) + if(istype(used_weapon,/obj/item)) + var/obj/item/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.embed(W) return 1 diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 9f13590f8a..0b7be48153 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -59,7 +59,7 @@ if ((proj_sharp || proj_edge) && prob(getarmor(def_zone, P.flag))) proj_sharp = 0 proj_edge = 0 - + if(!P.nodamage) apply_damage(P.damage, P.damage_type, def_zone, absorb, 0, P, sharp=proj_sharp, edge=proj_edge) P.on_hit(src, absorb, def_zone) @@ -75,8 +75,9 @@ dtype = W.damtype src.visible_message("\red [src] has been hit by [O].") var/armor = run_armor_check(zone, "melee", "Your armor has protected your [zone].", "Your armor has softened hit to your [zone].") + if(armor < 2) - apply_damage(O.throwforce*(speed/5), dtype, zone, armor, O, sharp=is_sharp(O), edge=has_edge(O)) + apply_damage(O.throwforce*(speed/5), dtype, zone, armor, is_sharp(O), has_edge(O), O) if(!O.fingerprintslast) return @@ -92,7 +93,7 @@ // Begin BS12 momentum-transfer code. - if(speed >= 20) + if(speed >= 15) var/obj/item/weapon/W = O var/momentum = speed/2 var/dir = get_dir(M,src) @@ -100,6 +101,8 @@ visible_message("\red [src] staggers under the impact!","\red You stagger under the impact!") src.throw_at(get_edge_target_turf(src,dir),1,momentum) + if(!W || !src) return + if(istype(W.loc,/mob/living) && W.sharp) //Projectile is embedded and suitable for pinning. if(!istype(src,/mob/living/carbon/human)) //Handles embedding for non-humans and simple_animals. diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index e54de9c9c1..3040b0bddc 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -337,7 +337,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: @@ -349,10 +349,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() @@ -367,7 +367,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 @@ -376,41 +376,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) @@ -753,7 +753,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") @@ -778,7 +778,9 @@ player's body, though, antitox and spaceacillin are easy enough to get I doubt i if(ismob(W.loc)) var/mob/living/H = W.loc H.drop_item() - W.loc = owner/**************************************************** + W.loc = owner + +/**************************************************** ORGAN DEFINES ****************************************************/ @@ -806,7 +808,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") @@ -827,7 +829,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") @@ -866,7 +868,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") @@ -878,7 +880,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")