From e2e798382c9e97c1cd97bf9c95b651f17739e702 Mon Sep 17 00:00:00 2001 From: LordFowl Date: Sat, 10 Mar 2018 10:18:27 -0500 Subject: [PATCH] [Ready for Review] Nerfs IPCs Part 1/1,034 (#4229) Refactors electrocute_act slightly. Electricity will now only start in your hands if ground_zero is explicitly set to l_hand or r_hand. All instances where electrocute_act is called because you touched something (IE opening a crate, touching the powergrid) have been set so that ground_zero is your currently active hand. Otherwise, ground_zero will be randomly selected from available organs. This is important because it is the siemens_coefficient of ground_zero only that affects electrical conductivity. EG if you get tesla_zapped in the chest you will not be saved by wearing insulated gloves. Once the electricity is in your body it does not matter. Sufficiently powerful electricity (shock_damage >= 6) will induce an EMP in the relevant contact zones. This EMP will affect all items in the relevant organ only. Shock damage will still become reduced as the arc propagates through your body, and the EMP's produced will be updated accordingly. The IPC power cell organ will now produce effects when EMP'd based on the current damage value of the organ pre-decrement, ranging from stuttering and blurriness to unconsciousness. Other special EMP effects for other IPC organs are pending, but I am thinking of holding it off for Part 2/1,034 Baton class weapons have been modified. Their raw force damage has been reduced, but they will now deal shock damage to a roughly equivalent value. Harmbatons will deal 5 brute and 10 shock, and their electrocute_act will have a defined def zone (e.g it is a localized shock and there will be no arcs) Cattleprods will deal 3 brute and 6 shock on both harm and help intents, and their electrocute_act is non-localized and will cause arcing. Stunrods will deal 7 brute and 14 shock on both harm and help intents, and their electrocute_act is non-localized and will cause arcing. (For clarification, cattleprods and stunrods currently still deal no brute on help intent, but will cause shock damage) Fixes an issue with electrocute_act where if def_zone is called would not actually do anything. --- code/game/objects/items/weapons/stunbaton.dm | 13 ++- .../structures/crates_lockers/crates.dm | 9 +- code/modules/mob/living/carbon/human/human.dm | 83 +++++++++++++------ code/modules/mob/living/living_defense.dm | 2 +- code/modules/organs/organ.dm | 3 +- code/modules/organs/subtypes/machine.dm | 12 +++ code/modules/power/power.dm | 7 +- html/changelogs/harmbaton.yml | 40 +++++++++ 8 files changed, 137 insertions(+), 32 deletions(-) create mode 100644 html/changelogs/harmbaton.yml diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index 5dec465c1db..6c7ad5958d7 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -5,7 +5,7 @@ icon_state = "stunbaton" item_state = "baton" slot_flags = SLOT_BELT - force = 15 + force = 5 sharp = 0 edge = 0 throwforce = 7 @@ -18,6 +18,7 @@ var/obj/item/weapon/cell/bcell var/hitcost = 1000 //oh god why do power cells carry so much charge? We probably need to make a distinction between "industrial" sized power cells for APCs and power cells for everything else. var/baton_color = "#FF6A00" + var/sheathed = 1 //electrocutes only on harm intent /obj/item/weapon/melee/baton/Initialize() . = ..() @@ -125,6 +126,10 @@ stun *= 0.5 if(status) //Checks to see if the stunbaton is on. agony *= 0.5 //whacking someone causes a much poorer contact than prodding them. + if(sheathed) //however breaking the skin results in a more potent electric shock or some bullshit. im a coder, not a doctor + L.electrocute_act(force * 2, src, def_zone = target_zone) + else + L.electrocute_act(force * 2, src, ground_zero = target_zone) else agony = 0 //we can't really extract the actual hit zone from ..(), unfortunately. Just act like they attacked the area they intended to. @@ -151,6 +156,7 @@ return 1 else H.visible_message("[L] has been prodded in the [affecting.name] with [src] by [user]!") + H.electrocute_act(force * 2, src, ground_zero = target_zone) else if(!status) L.visible_message("[L] has been prodded with [src] by [user]. Luckily it was off.") @@ -221,6 +227,7 @@ attack_verb = list("poked") slot_flags = null baton_color = "#FFDF00" + sheathed = 0 /obj/item/weapon/melee/baton/stunrod name = "stunrod" @@ -228,10 +235,11 @@ icon = 'icons/obj/stunrod.dmi' icon_state = "stunrod" item_state = "stunrod" - force = 20 + force = 7 baton_color = "#75ACFF" origin_tech = list(TECH_COMBAT = 4, TECH_ILLEGAL = 2) contained_sprite = 1 + sheathed = 0 /obj/item/weapon/melee/baton/stunrod/Initialize() bcell = new/obj/item/weapon/cell/high(src) @@ -262,6 +270,7 @@ stunforce = 1 origin_tech = list(TECH_COMBAT = 1) contained_sprite = 1 + sheathed = 0 /obj/item/weapon/melee/baton/slime/Initialize() bcell = new/obj/item/weapon/cell/high(src) diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index d5ace98cb75..4349345c0bf 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -31,9 +31,14 @@ if(rigged && locate(/obj/item/device/radio/electropack) in src) if(isliving(usr)) var/mob/living/L = usr - if(L.electrocute_act(17, src)) + var/touchy_hand + if(L.hand) + touchy_hand = "r_hand" + else + touchy_hand = "l_hand" + if(L.electrocute_act(17, src, ground_zero = touchy_hand)) spark(src, 5, alldirs) - if(usr.stunned) + if(L.stunned) return 2 playsound(loc, 'sound/machines/click.ogg', 15, 1, -3) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 640ffefa6e1..e1224414152 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -404,8 +404,9 @@ if(wear_id) return wear_id.GetID() -/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) +/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/ground_zero) var/hairvar = 0 + var/list/damage_areas = list() if(status_flags & GODMODE) return 0 //godmode if (!tesla_shock) @@ -414,7 +415,7 @@ return 0 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. + //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 @@ -423,7 +424,7 @@ 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") + 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) @@ -437,31 +438,65 @@ 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 + else + damage_areas = list(def_zone) - for (var/area in damage_areas) - apply_damage(shock_damage, BURN, area, used_weapon="Electrocution") - shock_damage *= 0.4 - playsound(loc, "sparks", 50, 1, -1) + if(!ground_zero) + ground_zero = pick(damage_areas) - if (shock_damage > 15 || tesla_shock) - visible_message( - "[src] was shocked by the [source]!", - "You feel a powerful shock course through your body!", - "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) + if(!(ground_zero in damage_areas)) + damage_areas.Add(ground_zero) //sucks to suck, get more zappy time bitch - else - visible_message( - "[src] was mildly shocked by the [source].", - "You feel a mild shock course through your body.", - "You hear a light zapping." - ) + var/obj/item/organ/external/contact = get_organ(check_zone(ground_zero)) + shock_damage *= get_siemens_coefficient_organ(contact) - spark(loc, 5, alldirs) + var/obj/item/organ/external/affecting + for (var/area in damage_areas) + + affecting = get_organ(check_zone(area)) + var/emp_damage + switch(shock_damage) + if(-INFINITY to 5) + emp_damage = 0 + if(6 to 19) + emp_damage = 3 + if(20 to 49) + emp_damage = 2 + else + emp_damage = 1 + + if(emp_damage) + for(var/obj/item/organ/O in affecting.internal_organs) + O.emp_act(emp_damage) + emp_damage *= 0.4 + for(var/obj/item/I in affecting.implants) + I.emp_act(emp_damage) + emp_damage *= 0.4 + for(var/obj/item/I in affecting) + I.emp_act(emp_damage) + emp_damage *= 0.4 + + apply_damage(shock_damage, BURN, area, used_weapon="Electrocution") + shock_damage *= 0.4 + playsound(loc, "sparks", 50, 1, -1) + + if (shock_damage > 15 || tesla_shock) + visible_message( + "[src] was shocked by the [source]!", + "You feel a powerful shock course through your body!", + "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 + visible_message( + "[src] was mildly shocked by the [source].", + "You feel a mild shock course through your body.", + "You hear a light zapping." + ) + + spark(loc, 5, alldirs) return shock_damage diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 5dae43d44b5..010b6c8d612 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -128,7 +128,7 @@ return target_zone //Called when the mob is hit with an item in combat. Returns the blocked result -/mob/living/proc/hit_with_weapon(obj/item/I, mob/living/user, var/effective_force, var/hit_zone) +/mob/living/proc/hit_with_weapon(obj/item/I, mob/living/user, var/effective_force, var/hit_zone, var/ground_zero) visible_message("[src] has been [LAZYPICK(I.attack_verb,"attacked")] with [I] by [user]!") var/blocked = run_armor_check(hit_zone, "melee") diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index 98f3b837a28..5e57c1ce380 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -283,13 +283,12 @@ /obj/item/organ/emp_act(severity) if(!(status & ORGAN_ROBOT)) return + switch (severity) if (1.0) take_damage(rand(7,20) * emp_coeff) - return if (2.0) take_damage(rand(3,7) * emp_coeff) - return if(3.0) take_damage(rand(3) * emp_coeff) diff --git a/code/modules/organs/subtypes/machine.dm b/code/modules/organs/subtypes/machine.dm index 81130b4e5ec..5234641d457 100644 --- a/code/modules/organs/subtypes/machine.dm +++ b/code/modules/organs/subtypes/machine.dm @@ -65,11 +65,23 @@ organ_tag = "cell" parent_organ = "chest" vital = 1 + var/emp_counter = 0 /obj/item/organ/cell/Initialize() robotize() . = ..() +/obj/item/organ/cell/process() + ..() + if(emp_counter) + emp_counter-- + +/obj/item/organ/cell/emp_act(severity) + emp_counter += 30/severity + if(emp_counter >= 30) + owner.Paralyse(emp_counter/6) + owner << "%#/ERR: Power leak detected!$%^/" + /obj/item/organ/cell/replaced() . = ..() // This is very ghetto way of rebooting an IPC. TODO better way. diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 7d276aebfd5..37705e74b7b 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -383,7 +383,12 @@ else power_source = cell shock_damage = cell_damage - var/drained_hp = M.electrocute_act(shock_damage, source, siemens_coeff) //zzzzzzap! + var/touchy_hand + if(M.hand) + touchy_hand = "r_hand" + else + touchy_hand = "l_hand" + var/drained_hp = M.electrocute_act(shock_damage, source, siemens_coeff, ground_zero = touchy_hand) //zzzzzzap! var/drained_energy = drained_hp*20 if (source_area) diff --git a/html/changelogs/harmbaton.yml b/html/changelogs/harmbaton.yml new file mode 100644 index 00000000000..4d80ebdedfe --- /dev/null +++ b/html/changelogs/harmbaton.yml @@ -0,0 +1,40 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +################################# + +# Your name. +author: LordFowl + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "Batons will now deal both brute and shock damage." + - tweak: "Electricity system modified to be more realistic in its arcing and damage," + - tweak: "Electricity can now cause electronic damage." + - rscadd: "IPCs will now be paralysed by cattleprods, stunrods, and harmbatons targeted at the chest."