From 64638987dc118efae11f69ed239ad1e83285432a Mon Sep 17 00:00:00 2001 From: mwerezak Date: Thu, 31 Jul 2014 15:38:56 -0400 Subject: [PATCH] Adds siemens_coefficient handling to stun batons Conflicts: code/game/objects/items/weapons/stunbaton.dm --- code/game/objects/items/weapons/stunbaton.dm | 23 ++++++++++----- .../mob/living/carbon/human/human_defense.dm | 29 +++++++++---------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index 857202f9647..77aec323a24 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -119,12 +119,14 @@ return var/agony = agonyforce + var/stun = stunforce var/mob/living/L = M var/contact = 1 if(user.a_intent == "harm") contact = ..() agony *= 0.5 //whacking someone causes a much poorer contact than prodding them. + stun *= 0.5 else //copied from human_defense.dm if (ishuman(L)) @@ -151,18 +153,25 @@ L.visible_message("[L] has been prodded with [src] by [user]. Luckily it was off.") else L.visible_message("[L] has been prodded with [src] by [user]!") - msg_admin_attack("[key_name(user)] attempted to stun [key_name(L)] with the [src].") //stun effects if (contact) - if (stunforce) - L.Stun(stunforce) - L.Weaken(stunforce) - L.apply_effect(STUTTER, stunforce) + msg_admin_attack("[key_name(user)] attempted to stun [key_name(L)] with the [src].") + + if (ishuman(L)) + var/mob/living/carbon/human/H = L + var/datum/organ/external/affected = get_organ(def_zone) + var/siemens_coeff = H.get_siemens_coefficient_organ(affected) + stun *= siemens_coeff + agony *= siemens_coeff + + if (stun) + L.Stun(stun) + L.Weaken(stun) + L.apply_effect(STUTTER, stun) if (agony) - //Siemens coefficient? - //TODO: Merge this with taser effects + //perhaps this could be merged with taser effects? L.apply_effect(agony,AGONY,0) L.apply_effect(STUTTER, agony/10) L.apply_effect(EYE_BLUR, agony/10) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index fe4c908fab0..33f3308b7c4 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -109,21 +109,6 @@ emp_act organnum++ return (armorval/max(organnum, 1)) -//this proc returns the Siemens coefficient of electrical resistivity for a particular external organ. -/mob/living/carbon/human/proc/get_siemens_coefficient_organ(var/datum/organ/external/def_zone) - if (!def_zone) - return 1.0 - - var/siemens_coefficient = 1.0 - - var/list/clothing_items = list(head, wear_mask, wear_suit, w_uniform, gloves, shoes) // What all are we checking? - for(var/obj/item/clothing/C in clothing_items) - if(!istype(C)) //is this necessary? - continue - else if(C.body_parts_covered & def_zone.body_part) // Is that body part being targeted covered? - siemens_coefficient *= C.siemens_coefficient - - return siemens_coefficient //this proc returns the armour value for a particular external organ. /mob/living/carbon/human/proc/getarmor_organ(var/datum/organ/external/def_zone, var/type) @@ -138,6 +123,20 @@ emp_act protection += C.armor[type] return protection +//this proc returns the Siemens coefficient of electrical resistivity for a particular external organ. +/mob/living/carbon/human/proc/get_siemens_coefficient_organ(var/datum/organ/external/def_zone) + if (!def_zone) + return 1.0 + + var/siemens_coefficient = 1.0 + + var/list/clothing_items = list(head, wear_mask, wear_suit, w_uniform, gloves, shoes) // What all are we checking? + for(var/obj/item/clothing/C in clothing_items) + if(istype(C) && (C.body_parts_covered & def_zone.body_part)) // Is that body part being targeted covered? + siemens_coefficient *= C.siemens_coefficient + + return siemens_coefficient + /mob/living/carbon/human/proc/check_head_coverage() var/list/body_parts = list(head, wear_mask, wear_suit, w_uniform)