Merges taser and stun baton effects

Makes the code for handling stun weapon effects much cleaner.
Moves electrocute_act and emp_act from living.dm into living_defense.dm
This commit is contained in:
mwerezak
2014-07-31 16:21:22 -04:00
parent c8cccb64f6
commit 56ccd4303b
6 changed files with 57 additions and 61 deletions
@@ -59,18 +59,7 @@ emp_act
//BEGIN BOOK'S TASER NERF.
if(istype(P, /obj/item/projectile/beam/stun))
var/datum/organ/external/select_area = get_organ(def_zone) // We're checking the outside, buddy!
var/list/clothing_items = list(head, wear_mask, wear_suit, w_uniform, gloves, shoes) // What all are we checking?
for(var/obj/item/clothing/CL in clothing_items) //Make an unregulated var to pass around.
if(!istype(CL)) //This isn't necessary, is it?
continue
if(CL.body_parts_covered & select_area.body_part) // Is that body part being targeted covered by CL?
P.agony *= CL.siemens_coefficient
//blocked = 0 here as we've already adjused based on siemens_coefficient.
apply_effect(P.agony,AGONY,0)
flash_pain()
stun_effect_act(0, P.agony, def_zone)
src <<"\red You have been hit by [P]!"
del P
return
@@ -88,6 +77,19 @@ emp_act
return (..(P , def_zone))
/mob/living/carbon/human/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone)
switch (def_zone)
if("head")
agony_amount *= 1.25
//if("l_hand", "r_hand") //TODO
//if("l_foot", "r_foot") //TODO
var/datum/organ/external/affected = get_organ(check_zone(def_zone))
var/siemens_coeff = get_siemens_coefficient_organ(affected)
stun_amount *= siemens_coeff
agony_amount *= siemens_coeff
..(stun_amount, agony_amount, def_zone)
/mob/living/carbon/human/getarmor(var/def_zone, var/type)
var/armorval = 0
@@ -191,7 +193,7 @@ emp_act
/mob/living/carbon/human/proc/attacked_by(var/obj/item/I, var/mob/living/user, var/def_zone)
if(!I || !user) return 0
var/target_zone = def_zone? def_zone : get_zone_with_miss_chance(user.zone_sel.selecting, src)
var/target_zone = def_zone? check_zone(def_zone) : get_zone_with_miss_chance(user.zone_sel.selecting, src)
if(user == src) // Attacking yourself can't miss
target_zone = user.zone_sel.selecting
-9
View File
@@ -202,15 +202,6 @@
return 0
/mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0)
return 0 //only carbon liveforms have this proc
/mob/living/emp_act(severity)
var/list/L = src.get_contents()
for(var/obj/O in L)
O.emp_act(severity)
..()
/mob/living/proc/can_inject()
return 1
+24
View File
@@ -65,6 +65,30 @@
P.on_hit(src, absorb, def_zone)
return absorb
//Handles the effects of "stun" weapons
/mob/living/proc/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone)
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_effect(agony_amount, AGONY,0)
apply_effect(STUTTER, agony_amount/10)
apply_effect(EYE_BLUR, agony_amount/10)
/mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0)
return 0 //only carbon liveforms have this proc
/mob/living/emp_act(severity)
var/list/L = src.get_contents()
for(var/obj/O in L)
O.emp_act(severity)
..()
//this proc handles being hit by a thrown atom
/mob/living/hitby(atom/movable/AM as mob|obj,var/speed = 5)//Standardization and logging -Sieve
if(istype(AM,/obj/))
@@ -34,6 +34,9 @@
src << "\red Warning: Electromagnetic pulse detected."
..()
/mob/living/silicon/stun_effect_act(var/stun_amount, var/agony_amount)
return //immune
/mob/living/silicon/proc/damage_mob(var/brute = 0, var/fire = 0, var/tox = 0)
return
-11
View File
@@ -129,17 +129,6 @@ proc/hasorgans(A)
zone = "head"
if("mouth")
zone = "head"
/* if("l_hand")
zone = "l_arm"
if("r_hand")
zone = "r_arm"
if("l_foot")
zone = "l_leg"
if("r_foot")
zone = "r_leg"
if("groin")
zone = "chest"
*/
return zone
// Returns zone with a certain probability.