From 0ab1a02ac8f5615500481b4a08a7ee7c2e58c3e3 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sun, 15 Mar 2015 17:59:22 +0100 Subject: [PATCH] EMP_Act for spacepods, disables movement, eats cell charge, largely impacts health, also makes ion rifles work correctly against pods --- code/game/vehicles/spacepods/spacepod.dm | 52 +++++++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/code/game/vehicles/spacepods/spacepod.dm b/code/game/vehicles/spacepods/spacepod.dm index 91d3b5935a0..0d3102c1d00 100644 --- a/code/game/vehicles/spacepods/spacepod.dm +++ b/code/game/vehicles/spacepods/spacepod.dm @@ -30,6 +30,7 @@ var/lights = 0 var/lights_power = 6 var/allow2enter = 1 + var/empcounter = 0 //Used for disabling movement when hit by an EMP /obj/spacepod/New() . = ..() @@ -56,6 +57,13 @@ spacepods_list -= src ..() +/obj/spacepod/process() + if(src.empcounter > 0) + src.empcounter-- + else + processing_objects.Remove(src) + + /obj/spacepod/proc/update_icons() if(!pod_overlays) pod_overlays = new/list(2) @@ -72,6 +80,8 @@ /obj/spacepod/bullet_act(var/obj/item/projectile/P) if(P.damage && !P.nodamage) deal_damage(P.damage) + else if(P.flag == "energy" && istype(P,/obj/item/projectile/ion)) //needed to make sure ions work properly + empulse(src, 1, 1) /obj/spacepod/blob_act() deal_damage(30) @@ -159,6 +169,36 @@ if(prob(40)) deal_damage(50) +/obj/spacepod/emp_act(severity) + switch(severity) + if(1) + if(src.occupant) + src.occupant << "The pod console flashes 'Heavy EMP WAVE DETECTED'." //warn the occupants + if(src.occupant2) + src.occupant2 << "The pod console flashes 'EMP WAVE DETECTED'." //warn the occupants + + if(battery) + battery.charge = max(0, battery.charge - 5000) //Cell EMP act is too weak, this pod needs to be sapped. + src.deal_damage(100) + if(src.empcounter < 40) + src.empcounter = 40 //Disable movement for 40 ticks. Plenty long enough. + processing_objects.Add(src) + + if(2) + if(src.occupant) + src.occupant << "The pod console flashes 'EMP WAVE DETECTED'." //warn the occupants + if(src.occupant2) + src.occupant2 << "The pod console flashes 'EMP WAVE DETECTED'." //warn the occupants + + src.deal_damage(40) + if(battery) + battery.charge = max(0, battery.charge - 2500) //Cell EMP act is too weak, this pod needs to be sapped. + if(src.empcounter < 20) + src.empcounter = 20 //Disable movement for 20 ticks. + processing_objects.Add(src) + + + /obj/spacepod/attackby(obj/item/W as obj, mob/user as mob, params) if(iscrowbar(W)) hatch_open = !hatch_open @@ -454,10 +494,6 @@ else if(src.occupant2 && !src.occupant) usr << "\red You can't put a corpse into the driver's seat!" return - else - return - else - return else return else @@ -841,7 +877,7 @@ obj/spacepod/verb/toggleLights() if(src.occupant2) if(user.ckey != src.occupant2.ckey) var/moveship = 1 - if(battery && battery.charge >= 3 && health) + if(battery && battery.charge >= 3 && health && empcounter == 0) src.dir = direction switch(direction) if(1) @@ -871,6 +907,8 @@ obj/spacepod/verb/toggleLights() user << "Not enough charge left." else if(!health) user << "She's dead, Jim" + else if(empcounter != 0) + user << "The pod control interface isn't responding. The console indicates [empcounter] seconds before reboot." else user << "Unknown error has occurred, yell at pomf." return 0 @@ -880,7 +918,7 @@ obj/spacepod/verb/toggleLights() else var/moveship = 1 - if(battery && battery.charge >= 3 && health) + if(battery && battery.charge >= 3 && health && empcounter == 0) src.dir = direction switch(direction) if(1) @@ -910,6 +948,8 @@ obj/spacepod/verb/toggleLights() user << "Not enough charge left." else if(!health) user << "She's dead, Jim" + else if(empcounter != 0) + user << "The pod control interface isn't responding. The console indicates [empcounter] seconds before reboot." else user << "Unknown error has occurred, yell at pomf." return 0