From 85d0e3c1c58f1b07f39e09a7a5ae0572ec1bed32 Mon Sep 17 00:00:00 2001 From: Pacmandevil Date: Mon, 3 Jul 2017 15:59:37 -0300 Subject: [PATCH] Changes Electrocute_act (#2866) As it works currently: Electrocute_act, the proc called when anybody gets shocked, has several problems. As it is now - it only damages the hand. These changes Allow it to "arc" through one of 6 possible arcs: *left to right hand *right to left hand *right hand to right foot *right hand to left foot *left hand to right foot *left hand to left foot *Snowflake hand to head to hair to ground fuck the braid the "arcs" Check the siemens_coefficient of the entry and exit points of the Arcs when calculating damage - So you won't take any damage if you have insulated gloves, and I'm not sure if any shoes have that. but it tries to calculate it anyway. Who knows, Janitor might be buffed. I've also taken the 60 seconds it took to add the proc to simple_animals. it's just flat damage right now though. I'll probably spruce it up in the future if nobody else does. The proc shouldn't in theory work any differently if you provided a def_zone for it to target - it'll still just damage the one area. but if no specific area is provided. it'll "arc" --- code/modules/mob/living/carbon/human/human.dm | 41 +++++++++++++++---- .../mob/living/simple_animal/simple_animal.dm | 5 +++ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 92cd259ba3a..1de9dc9d795 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -409,22 +409,45 @@ if(wear_id) return wear_id.GetID() -//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, var/tesla_shock = 0) + var/hairvar = 0 if(status_flags & GODMODE) return 0 //godmode + if(!def_zone) + var/list/damage_areas = list() //The way this works is by damaging multiple areas in an "Arc" if no def_zone is provided. should be pretty easy to add more arcs if it's needed. though I can't imangine a situation that can apply. + if(istype(user, /mob/living/carbon/human)) + if(h_style == "Floorlength Braid" || h_style == "Very Long Hair") + hairvar = 1 + var/count = hairvar == 1 ? rand(1, 7) : rand(1, 6) + switch (count) + if(1) + damage_areas = list("l_hand", "l_arm", "chest", "r_arm", "r_hand") + if(2) + damage_areas = list("r_hand", "r_arm", "chest", "l_arm", "L_hand") + if(3) + damage_areas = list("l_hand", "l_arm", "chest", "groin", "l_leg", "l_foot") + if(4) + damage_areas = list("l_hand", "l_arm", "chest", "groin", "r_leg", "r_foot") + if(5) + damage_areas = list("r_hand", "r_arm", "chest", "groin", "r_leg", "r_foot") + if(6) + damage_areas = list("r_hand", "r_arm", "chest", "groin", "l_leg", "l_foot") + if(7)//snowflake arc - only happens when they have long hair. + damage_areas = list("r_hand", "r_arm", "chest", "head") + h_style = "skinhead" + visible_message("[src]'s hair gets a burst of electricty through it, burning and turning to dust!", "your hair burns as the current flows through it, turning to dust!", "You hear a crackling sound, and smell burned hair!.") + update_hair() + if(gloves) + shock_damage *= gloves.siemens_coefficient - if (!def_zone) - def_zone = pick("l_hand", "r_hand") - + for (var/area in damage_areas) + apply_damage(shock_damage, BURN, area) + shock_damage *= 0.8 + visible_message("[src] was shocked by [source]!", "You are shocked by [source]!", "You hear an electrical crack.") var/obj/item/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, tesla_shock) - /mob/living/carbon/human/Topic(href, href_list) - if (href_list["refresh"]) if((machine)&&(in_range(src, usr))) show_inv(machine) @@ -1476,4 +1499,4 @@ if(stat) return pulling_punches = !pulling_punches src << "You are now [pulling_punches ? "pulling your punches" : "not pulling your punches"]." - return + return \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 2eb23df75c9..d2d100308c3 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -685,3 +685,8 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) src << span("notice","You are now [resting ? "resting" : "getting up"]") update_icons() + +//Todo: add snowflakey shit to it. +/mob/living/simple_animal/electrocute_act(var/shock_damage, var/obj/source, var/base_siemens_coeff = 1.0, var/def_zone = null, var/tesla_shock = 0) + apply_damage(shock_damage, BURN) + visible_message("[src] was shocked by [source]!", "You are shocked by [source]!", "You hear an electrical crack.") \ No newline at end of file