Fixes siemens_coefficent not affecting shock damage

Also cleans up electrocute_act()
This commit is contained in:
mwerezak
2014-07-31 15:20:45 -04:00
parent 01600316ea
commit b529d582e5
5 changed files with 52 additions and 32 deletions

View File

@@ -99,24 +99,29 @@
return
/mob/living/carbon/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0)
/mob/living/carbon/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0, var/def_zone = null)
if(status_flags & GODMODE) return 0 //godmode
shock_damage *= siemens_coeff
if (shock_damage<1)
return 0
src.take_overall_damage(0,shock_damage,used_weapon="Electrocution")
//src.burn_skin(shock_damage)
//src.adjustFireLoss(shock_damage) //burn_skin will do this for us
//src.updatehealth()
src.visible_message(
"\red [src] was shocked by the [source]!", \
"\red <B>You feel a powerful shock course through your body!</B>", \
"\red You hear a heavy electrical crack." \
)
// if(src.stunned < shock_damage) src.stunned = shock_damage
Stun(10)//This should work for now, more is really silly and makes you lay there forever
// if(src.weakened < 20*siemens_coeff) src.weakened = 20*siemens_coeff
Weaken(10)
src.apply_damage(shock_damage, BURN, def_zone, used_weapon="Electrocution")
playsound(loc, "sparks", 50, 1, -1)
if (shock_damage > 10)
src.visible_message(
"\red [src] was shocked by the [source]!", \
"\red <B>You feel a powerful shock course through your body!</B>", \
"\red You hear a heavy electrical crack." \
)
Stun(10)//This should work for now, more is really silly and makes you lay there forever
Weaken(10)
else
src.visible_message(
"\red [src] was mildly shocked by the [source].", \
"\red You feel a mild shock course through your body.", \
"\red You hear a light zapping." \
)
return shock_damage

View File

@@ -521,13 +521,18 @@
if(wear_id)
return wear_id.GetID()
//Added a safety check in case you want to shock a human mob directly through electrocute_act.
/mob/living/carbon/human/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0, var/safety = 0)
if(!safety)
if(gloves)
var/obj/item/clothing/gloves/G = gloves
siemens_coeff = G.siemens_coefficient
return ..(shock_damage,source,siemens_coeff)
//Removed the horrible safety parameter. It was only being used by ninja code anyways.
//Now checks siemens_coefficient of the affected area by default
/mob/living/carbon/human/electrocute_act(var/shock_damage, var/obj/source, var/base_siemens_coeff = 1.0, var/def_zone = null)
if(status_flags & GODMODE) return 0 //godmode
if (!def_zone)
def_zone = pick("l_hand", "r_hand")
var/datum/organ/external/affected_organ = get_organ(check_zone(def_zone))
var/siemens_coeff = base_siemens_coeff * get_siemens_coefficient_organ(affected_organ)
return ..(shock_damage, source, siemens_coeff, def_zone)
/mob/living/carbon/human/Topic(href, href_list)

View File

@@ -54,15 +54,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/body_parts = list(head, wear_mask, wear_suit, w_uniform, gloves, shoes) // What all are we checking?
// var/deflectchance=90 //Is it a CRITICAL HIT with that taser?
for(var/bp in body_parts) //Make an unregulated var to pass around.
if(!bp)
continue //Does this thing we're shooting even exist?
if(bp && istype(bp ,/obj/item/clothing)) // If it exists, and it's clothed
var/obj/item/clothing/C = bp // Then call an argument C to be that clothing!
if(C.body_parts_covered & select_area.body_part) // Is that body part being targeted covered?
P.agony=P.agony*C.siemens_coefficient
P.agony *= get_siemens_coefficient_organ(select_area)
apply_effect(P.agony,AGONY,0)
flash_pain()
src <<"\red You have been shot!"
@@ -119,6 +111,21 @@ 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)
@@ -189,7 +196,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