EMP_Act for spacepods, disables movement, eats cell charge, largely

impacts health, also makes ion rifles work correctly against pods
This commit is contained in:
Tigercat2000
2015-03-15 17:59:22 +01:00
parent 84752bc5ed
commit 0ab1a02ac8
+46 -6
View File
@@ -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 << "<span class='warning'>The pod console flashes 'Heavy EMP WAVE DETECTED'.</span>" //warn the occupants
if(src.occupant2)
src.occupant2 << "<span class='warning'>The pod console flashes 'EMP WAVE DETECTED'.</span>" //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 << "<span class='warning'>The pod console flashes 'EMP WAVE DETECTED'.</span>" //warn the occupants
if(src.occupant2)
src.occupant2 << "<span class='warning'>The pod console flashes 'EMP WAVE DETECTED'.</span>" //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 <b>You can't put a corpse into the driver's seat!</b>"
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 << "<span class='warning'>Not enough charge left.</span>"
else if(!health)
user << "<span class='warning'>She's dead, Jim</span>"
else if(empcounter != 0)
user << "<span class='warning'>The pod control interface isn't responding. The console indicates [empcounter] seconds before reboot.</span>"
else
user << "<span class='warning'>Unknown error has occurred, yell at pomf.</span>"
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 << "<span class='warning'>Not enough charge left.</span>"
else if(!health)
user << "<span class='warning'>She's dead, Jim</span>"
else if(empcounter != 0)
user << "<span class='warning'>The pod control interface isn't responding. The console indicates [empcounter] seconds before reboot.</span>"
else
user << "<span class='warning'>Unknown error has occurred, yell at pomf.</span>"
return 0