Fix muh powergloves to work with new click code

This commit is contained in:
d3athrow
2014-03-30 01:06:04 -05:00
committed by ZomgPonies
parent 0dcee05ab2
commit 4601e9159f
+65
View File
@@ -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 << "<span class='warning'>[G] aren't ready to shock again!</span>"
return
src.visible_message("<span class='warning'>[name] fires an arc of electricity!</span>", \
"<span class='warning'>You fire an arc of electricity!</span>", \
"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 << "<span class='warning'>[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 << "<span class='warning'>[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