Files
Bubberstation/code/datums/mutations/touch.dm
SkyratBot eb75696ae9 [MIRROR] [NO GBP]Fixes tesla zaps. [MDB IGNORE] (#24698)
* [NO GBP]Fixes tesla zaps. (#79398)

## About The Pull Request
Closes #79297
Closes #79312

Due to the new cutoff parameter being added to tesla_zap() (from
#78310), and most callers used positional arguments instead of keywords,
the zap flags was getting fed the shocked_targets list and maybe other
junk. This caused a bunch of unusual phenomena. This is fixed by using
keyword arguments.

Tesla zaps that use the grid were significantly weaker in terms of
damage than they're supposed to be. This was a byproduct of trying to
convert everything to joules and removing unnecessary power multipliers.
This is fixed by reverting the damage scaling and zap power of zap
sources that aren't based on grid. Technically this will cause the zaps
from other sources to have less power, but these tend to not be able to
put power on grid, so this wouldn't have any change other than what a
grounding rod displays. Doesn't really matter.

Logs machine explosions from zap_act. Not the most helpful log (would
take a lot of effort to add an extra parameter to pass the source), but
better than nothing.

Probably other stuff I did, lol.
## Why It's Good For The Game
Stops zap fuckery. Admins can now find the explosions when a 9GeV engine
decides to go haywire or whatever.
## Changelog
🆑
fix: Fixes tesla zaps being weird.
admin: Logs explosions from explosive zaps.
/🆑

* [NO GBP]Fixes tesla zaps.

---------

Co-authored-by: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com>
2023-10-31 10:29:50 -07:00

88 lines
3.5 KiB
Plaintext

/datum/mutation/human/shock
name = "Shock Touch"
desc = "The affected can channel excess electricity through their hands without shocking themselves, allowing them to shock others."
quality = POSITIVE
locked = TRUE
difficulty = 16
text_gain_indication = "<span class='notice'>You feel power flow through your hands.</span>"
text_lose_indication = "<span class='notice'>The energy in your hands subsides.</span>"
power_path = /datum/action/cooldown/spell/touch/shock
instability = 35
energy_coeff = 1
power_coeff = 1
/datum/mutation/human/shock/modify()
. = ..()
var/datum/action/cooldown/spell/touch/shock/to_modify =.
if(!istype(to_modify)) // null or invalid
return
if(GET_MUTATION_POWER(src) <= 1)
to_modify.chain = initial(to_modify.chain)
return
to_modify.chain = TRUE
/datum/action/cooldown/spell/touch/shock
name = "Shock Touch"
desc = "Channel electricity to your hand to shock people with."
button_icon_state = "zap"
sound = 'sound/weapons/zapbang.ogg'
cooldown_time = 12 SECONDS
invocation_type = INVOCATION_NONE
spell_requirements = NONE
antimagic_flags = NONE
//Vars for zaps made when power chromosome is applied, ripped and toned down from reactive tesla armor code.
///This var decides if the spell should chain, dictated by presence of power chromosome
var/chain = FALSE
///Affects damage, should do about 1 per limb
var/zap_power = 7500
///Range of tesla shock bounces
var/zap_range = 7
///flags that dictate what the tesla shock can interact with, Can only damage mobs, Cannot damage machines or generate energy
var/zap_flags = ZAP_MOB_DAMAGE
hand_path = /obj/item/melee/touch_attack/shock
draw_message = span_notice("You channel electricity into your hand.")
drop_message = span_notice("You let the electricity from your hand dissipate.")
/datum/action/cooldown/spell/touch/shock/cast_on_hand_hit(obj/item/melee/touch_attack/hand, atom/victim, mob/living/carbon/caster)
if(iscarbon(victim))
var/mob/living/carbon/carbon_victim = victim
if(carbon_victim.electrocute_act(15, caster, 1, SHOCK_NOGLOVES | SHOCK_NOSTUN))//doesnt stun. never let this stun
carbon_victim.dropItemToGround(carbon_victim.get_active_held_item())
carbon_victim.dropItemToGround(carbon_victim.get_inactive_held_item())
carbon_victim.adjust_confusion(15 SECONDS)
carbon_victim.visible_message(
span_danger("[caster] electrocutes [victim]!"),
span_userdanger("[caster] electrocutes you!"),
)
if(chain)
tesla_zap(source = victim, zap_range = zap_range, power = zap_power, cutoff = 1e3, zap_flags = zap_flags)
carbon_victim.visible_message(span_danger("An arc of electricity explodes out of [victim]!"))
return TRUE
else if(isliving(victim))
var/mob/living/living_victim = victim
if(living_victim.electrocute_act(15, caster, 1, SHOCK_NOSTUN))
living_victim.visible_message(
span_danger("[caster] electrocutes [victim]!"),
span_userdanger("[caster] electrocutes you!"),
)
if(chain)
tesla_zap(source = victim, zap_range = zap_range, power = zap_power, cutoff = 1e3, zap_flags = zap_flags)
living_victim.visible_message(span_danger("An arc of electricity explodes out of [victim]!"))
return TRUE
to_chat(caster, span_warning("The electricity doesn't seem to affect [victim]..."))
return TRUE
/obj/item/melee/touch_attack/shock
name = "\improper shock touch"
desc = "This is kind of like when you rub your feet on a shag rug so you can zap your friends, only a lot less safe."
icon = 'icons/obj/weapons/hand.dmi'
icon_state = "zapper"
inhand_icon_state = "zapper"