From 90e0da92cc1dcc59db63c766964ca206320ff86f Mon Sep 17 00:00:00 2001 From: mwerezak Date: Fri, 1 Aug 2014 23:53:33 -0400 Subject: [PATCH] Removes duplicate code from human/bullet_act Also moves stun projectile handling up to living/bullet_act, as all the human specific code has been moved to other procs Conflicts: code/modules/mob/living/carbon/human/human_defense.dm code/modules/mob/living/living_defense.dm --- .../mob/living/carbon/human/human_defense.dm | 43 +++---------------- code/modules/mob/living/living_defense.dm | 18 ++++++-- 2 files changed, 22 insertions(+), 39 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 6992a9db2e7..ec4d65d8973 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -12,23 +12,6 @@ emp_act var/datum/organ/external/organ = get_organ(check_zone(def_zone)) - //Being hit while using a cloaking device - var/obj/item/weapon/cloaking_device/C = locate((/obj/item/weapon/cloaking_device) in src) - if(C && C.active) - C.attack_self(src)//Should shut it off - update_icons() - src << "\blue Your [C.name] was disrupted!" - Stun(2) - -/* - //Being hit while using a deadman switch - if(istype(equipped(),/obj/item/device/assembly/signaler)) - var/obj/item/device/assembly/signaler/signaler = equipped() - if(signaler.deadman && prob(80)) - src.visible_message("\red [src] triggers their deadman's switch!") - signaler.signal() -*/ - //Shields if(check_shields(P.damage, "the [P.name]")) P.on_hit(src, 2, def_zone) @@ -59,14 +42,6 @@ emp_act return -1 // complete projectile permutation - //Tasers - if(istype(P, /obj/item/projectile/beam/stun)) - stun_effect_act(0, P.agony, def_zone, P) - src <<"\red You have been hit by [P]!" - del P - - return - //Shrapnel if (P.damage_type == BRUTE) var/armor = getarmor_organ(organ, "bullet") @@ -87,9 +62,7 @@ emp_act switch (def_zone) if("head") - //agony_amount *= 1.25 - agony_amount *= 1.50 //Targeting the head does add risk, so it should probably do more damage than average. - //if("l_foot", "r_foot") //TODO + agony_amount *= 1.50 if("l_hand", "r_hand") var/c_hand if (def_zone == "l_hand") @@ -98,8 +71,6 @@ emp_act c_hand = r_hand if(c_hand && (stun_amount || agony_amount > 10)) - //Not only do you need to guess the correct hand, but you also have a 50% (and increases with distance, in the case of tasers) miss chance when targeting the hands - //Since you can disarm someone by spamming disarm with a 60% success rate, it seems fair to have this be an automatic disarm, even for tasers. msg_admin_attack("[src.name] ([src.ckey]) was disarmed by a stun effect") u_equip(c_hand) @@ -329,17 +300,17 @@ emp_act if(bloody) bloody_body(src) - + //Melee weapon embedded object code. if (I.damtype == BRUTE && !I.is_robot_module()) var/damage = I.force if (armor) damage /= armor+1 - + //blunt objects should really not be embedding in things unless a huge amount of force is involved var/embed_chance = weapon_sharp? damage/I.w_class : damage/(I.w_class*3) var/embed_threshold = weapon_sharp? 5*I.w_class : 15*I.w_class - + //Sharp objects will always embed if they do enough damage. if((weapon_sharp && damage > (10*I.w_class)) || (damage > embed_threshold && prob(embed_chance))) affecting.embed(I) @@ -404,16 +375,16 @@ emp_act var/damage = throw_damage if (armor) damage /= armor+1 - + //blunt objects should really not be embedding in things unless a huge amount of force is involved var/embed_chance = sharp? damage/I.w_class : damage/(I.w_class*3) var/embed_threshold = sharp? 5*I.w_class : 15*I.w_class - + //Sharp objects will always embed if they do enough damage. //Thrown sharp objects have some momentum already and have a small chance to embed even if the damage is below the threshold if((sharp && prob(damage/(10*I.w_class)*100)) || (damage > embed_threshold && prob(embed_chance))) affecting.embed(I) - + // Begin BS12 momentum-transfer code. if(O.throw_source && speed >= 15) var/obj/item/weapon/W = O diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 799d3abe34f..bea2aa63f60 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -38,6 +38,9 @@ /mob/living/bullet_act(var/obj/item/projectile/P, var/def_zone) + flash_weak_pain() + + //Being hit while using a cloaking device var/obj/item/weapon/cloaking_device/C = locate((/obj/item/weapon/cloaking_device) in src) if(C && C.active) C.attack_self(src)//Should shut it off @@ -45,14 +48,23 @@ src << "\blue Your [C.name] was disrupted!" Stun(2) - flash_weak_pain() /* + //Being hit while using a deadman switch if(istype(equipped(),/obj/item/device/assembly/signaler)) var/obj/item/device/assembly/signaler/signaler = equipped() if(signaler.deadman && prob(80)) src.visible_message("\red [src] triggers their deadman's switch!") signaler.signal() */ + + //Stun Beams + if(istype(P, /obj/item/projectile/beam/stun) || istype(P, /obj/item/projectile/bullet/stunshot)) + stun_effect_act(0, P.agony, def_zone, P) + src <<"\red You have been hit by [P]!" + del P + return + + //Armor var/absorb = run_armor_check(def_zone, P.flag) var/proj_sharp = is_sharp(P) var/proj_edge = has_edge(P) @@ -71,13 +83,13 @@ //Handles the effects of "stun" weapons /mob/living/proc/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone, var/used_weapon=null) flash_pain() - + if (stun_amount) Stun(stun_amount) Weaken(stun_amount) apply_effect(STUTTER, stun_amount) apply_effect(EYE_BLUR, stun_amount) - + if (agony_amount) apply_damage(agony_amount, HALLOSS, def_zone, 0, used_weapon) apply_effect(STUTTER, agony_amount/10)