From 4601e9159fbc6d7efff4fe655b2e4428eb05ea9e Mon Sep 17 00:00:00 2001 From: d3athrow Date: Sun, 30 Mar 2014 01:06:04 -0500 Subject: [PATCH] Fix muh powergloves to work with new click code --- code/_onclick/click.dm | 65 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index f4e4283fa59..a39fee5163e 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -168,6 +168,8 @@ */ /mob/proc/RangedAttack(var/atom/A, var/params) if(!mutations.len) return + if(ishuman(src) && (istype(src:gloves, /obj/item/clothing/gloves/yellow/power)) && a_intent == "hurt") + PowerGlove(A) if((M_LASER in mutations) && a_intent == "harm") LaserEyes(A) // moved into a proc below return @@ -290,6 +292,69 @@ else src << "\red You're out of energy! You need food!" +/mob/proc/PowerGlove(atom/A) + return + +/mob/living/carbon/human/PowerGlove(atom/A) + var/obj/item/clothing/gloves/yellow/power/G = src:gloves + var/time = 100 + var/turf/T = get_turf(src) + var/turf/U = get_turf(A) + var/obj/structure/cable/cable = locate() in T + if(!cable || !istype(cable)) + return + if(world.time < G.next_shock) + src << "[G] aren't ready to shock again!" + return + src.visible_message("[name] fires an arc of electricity!", \ + "You fire an arc of electricity!", \ + "You hear the loud crackle of electricity!") + var/datum/powernet/PN = cable.get_powernet() + var/available = 0 + var/obj/item/projectile/beam/lightning/L = new /obj/item/projectile/beam/lightning/( get_turf(src) ) + if(PN) + available = PN.avail + L.damage = PN.get_electrocute_damage() + if(available >= 5000000) + L.damage = 205 + if(L.damage >= 200) + apply_damage(15, BURN, (hand ? "l_hand" : "r_hand")) + //usr:Stun(15) + //usr:Weaken(15) + //if(usr:status_flags & CANSTUN) // stun is usually associated with stutter + // usr:stuttering += 20 + time = 200 + src << "[G] overload from the massive current shocking you in the process!" + else if(L.damage >= 100) + apply_damage(5, BURN, (hand ? "l_hand" : "r_hand")) + //usr:Stun(10) + //usr:Weaken(10) + //if(usr:status_flags & CANSTUN) // stun is usually associated with stutter + // usr:stuttering += 10 + time = 150 + src << "[G] overload from the massive current shocking you in the process!" + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, src) + s.start() + if(L.damage <= 0) + del(L) + if(L) + playsound(get_turf(src), 'sound/effects/eleczap.ogg', 75, 1) + L.tang = L.adjustAngle(get_angle(U,T)) + L.icon = midicon + L.icon_state = "[L.tang]" + L.firer = usr + L.def_zone = get_organ_target() + L.original = src + L.current = U + L.starting = U + L.yo = U.y - T.y + L.xo = U.x - T.x + spawn( 1 ) + L.process() + + next_move = world.time + 12 + G.next_shock = world.time + time // Simple helper to face what you clicked on, in case it should be needed in more than one place /mob/proc/face_atom(var/atom/A) if( stat || buckled || !A || !x || !y || !A.x || !A.y ) return