-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Power gloves as a new engineering traitor item! (#1797)
* Adds Power Gloves NO GOON CODE WAS USED IN THE MAKING OF THIS PR -Adds Power Gloves: a traitor item that takes excess power from a wire underfoot and allows you to zap people with it -Changes the tesla_zap proc to have customizable bounces and max damage * Removed energy_ball dependancy -Changed tesla_zap into a specific glove_tesla_zap -Added more checks, finalized sounds. TODO: fix range bug * Final Fixed range bug, changed a few flavortext things and made icons fit in with default actions. * Fixes border Changes the overlay_icon_state to be an actual overlay, fixing the error sprite. * Improve readability Moves if else statements slightly to improve readability Co-authored-by: AlbertNanotracen <[email protected]> * Final2, ELECTRIC boogaloo Uncaps burn damage with a... Mostly sane equation. Adds in dusting. May need extra balancing if too powerful. * Requested changes Sets code up to standards. * Formatting fix Literally just moved equals signs * Power is sane changes units to be easily readable * Name change * hopefully this works? * oops * erm? * you silly goober * silly goober mode * minor refactor and logging Refactors checks to be more efficient, logs when electrocute acts are completed. * fixes my stupidity seriously what the fuck was i smoking * guh * guh pt2 * Lights now flicker and atmos techs can buy them :] * sigh * Some minor fixes and clarifications * Fixes range bug, adds activation messages * HOLY SHIT OOOOOOPS * MORE fixes * name formatting change --------- Co-authored-by: AlbertNanotracen <[email protected]> Co-authored-by: Lucy <[email protected]>
- Loading branch information
1 parent
d8b4e39
commit ec59c6a
Showing
4 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
monkestation/code/modules/clothing/gloves/power_gloves.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/obj/item/clothing/gloves/color/yellow/power_gloves | ||
name = "power gloves" | ||
desc = "Insulated gloves with onboard machinery that appears to be able to redirect the electrical current towards a creature. It only works if there is a powered cable underneath the user." | ||
armor_type = /datum/armor/power_gloves | ||
var/datum/action/cooldown/spell/pointed/glove_zap/zap = new | ||
|
||
/obj/item/clothing/gloves/color/yellow/power_gloves/Destroy() | ||
QDEL_NULL(zap) | ||
return ..() | ||
|
||
/datum/armor/power_gloves | ||
acid = 50 | ||
bio = 50 | ||
fire = 80 | ||
|
||
/datum/action/cooldown/spell/pointed/glove_zap | ||
name = "Unleash Electricity" | ||
desc = "INFINITE POWAHHH!!! Blast your foes with the electricity surging beneath your feet!" | ||
button_icon_state = "lightning" | ||
cooldown_time = 15 SECONDS | ||
spell_max_level = 1 | ||
check_flags = AB_CHECK_CONSCIOUS|AB_CHECK_HANDS_BLOCKED|AB_CHECK_INCAPACITATED | ||
sparks_amt = 4 | ||
spell_requirements = SPELL_REQUIRES_HUMAN | ||
antimagic_flags = NONE | ||
background_icon_state = ACTION_BUTTON_DEFAULT_BACKGROUND | ||
overlay_icon_state = "bg_default_border" | ||
active_msg = "You feel a faint buzz of electricity from beneath your feet." | ||
deactive_msg = "You feel the buzz of electricity dissipate." | ||
|
||
//had to recreate tesla zap into a pointed version | ||
/datum/action/cooldown/spell/pointed/glove_zap/proc/target_tesla_zap(atom/source, atom/target, power, zap_flags = ZAP_DEFAULT_FLAGS, max_damage = INFINITY) | ||
// damage the shock causes, be wary of fucking with the function without extensive testing. | ||
var/shock_damage = (zap_flags & ZAP_MOB_DAMAGE) ? (min(round( 5*(ROOT (4, (power)))), max_damage) + rand(-5, 5)) : 0 | ||
//24 damage at 10 KW, 75 damage at 1 MW, 132 at 10 MW, 420 at 1 GW (nice) | ||
var/mob/living/electrocute_victim = target | ||
var/dust_power = 10 GW | ||
var/heavy_emp_threshold = 1 MW | ||
|
||
source.Beam(target, icon_state="lightning[rand(1,12)]", time = 5) //Creates lightning beam | ||
var/zapdir = get_dir(source, target) | ||
if(zapdir) | ||
. = zapdir | ||
|
||
if(!isliving(target)) | ||
return | ||
|
||
if(power >= dust_power) //Dusts if there's enough in the grid | ||
electrocute_victim.electrocute_act(shock_damage, source, 1, SHOCK_TESLA | ((zap_flags & ZAP_MOB_STUN) ? NONE : SHOCK_NOSTUN)) | ||
log_combat(owner, target, "zapped", /obj/item/clothing/gloves/color/yellow/power_gloves, "[power] watts were used resulting in [shock_damage] damage.") | ||
|
||
else | ||
electrocute_victim.dust(TRUE, FALSE, TRUE) | ||
log_combat(owner, target, "zapped", /obj/item/clothing/gloves/color/yellow/power_gloves, "[power] watts were used resulting in the target dusting.") | ||
return | ||
|
||
|
||
if(issilicon(target)) //sillycons get emp'd | ||
var/mob/living/silicon/silicon_target = target | ||
if (power <= 10 KW) | ||
silicon_target.emp_act(EMP_LIGHT) | ||
else if (power <=heavy_emp_threshold) | ||
silicon_target.emp_act(EMP_HEAVY) | ||
|
||
/datum/action/cooldown/spell/pointed/glove_zap/proc/glove_nerd_zap(atom/target, /mob/living/owner) | ||
var/turf/owner_turf = get_turf(owner) | ||
var/obj/structure/cable/cable_target = owner_turf.get_cable_node() //Gets power from underfoot node | ||
var/heavy_zap = 100 MW | ||
if(!cable_target) | ||
owner.balloon_alert(owner, "Stand on a cable!") | ||
return | ||
var/surplus = cable_target.surplus() | ||
if(surplus <= 1 KW) | ||
owner.balloon_alert(owner, "Not enough power in the grid!") | ||
return | ||
else | ||
playsound(owner, 'monkestation/sound/weapons/powerglovestarget.ogg', 35, TRUE, -1) | ||
if(do_after(owner, 3 SECONDS, target, IGNORE_TARGET_LOC_CHANGE)) | ||
for(var/obj/machinery/light/light in get_area(owner)) | ||
light.flicker(amount = rand(3, 6)) | ||
if(get_dist(owner, target) >= cast_range) | ||
owner.balloon_alert(owner, "Target moved out of range!") | ||
return | ||
else | ||
var/calculated_power = surplus/20 //Calc_power, change division to balance | ||
target_tesla_zap(owner, target, calculated_power, SHOCK_NOSTUN, INFINITY) | ||
StartCooldown() | ||
if(surplus <= heavy_zap) //plays a separate sound at 2 MW excess | ||
playsound(target, 'sound/magic/lightningshock.ogg', 50, TRUE, -1) | ||
else | ||
playsound(target, 'sound/magic/lightningbolt.ogg', 50, TRUE, -1) | ||
|
||
/obj/item/clothing/gloves/color/yellow/power_gloves/equipped(mob/living/owner, slot) | ||
. = ..() | ||
if (slot & ITEM_SLOT_GLOVES) | ||
zap.Grant(owner) | ||
|
||
/obj/item/clothing/gloves/color/yellow/power_gloves/dropped(mob/living/owner, slot) | ||
. = ..() | ||
if (owner.get_item_by_slot(ITEM_SLOT_GLOVES) == src) | ||
zap.Remove(owner) | ||
|
||
/datum/action/cooldown/spell/pointed/glove_zap/InterceptClickOn(mob/living/user, params, atom/target) | ||
. = ..() | ||
glove_nerd_zap(target, user) | ||
return TRUE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters