mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Merge pull request #578 from tigercat2000/SpacePodEMP
EMP_Act for spacepods, disables movement, eats cell charge, largely
This commit is contained in:
@@ -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
|
||||
@@ -718,16 +754,7 @@
|
||||
return
|
||||
|
||||
/obj/spacepod/verb/fireWeapon()
|
||||
if(src.occupant2)
|
||||
if(usr.ckey != src.occupant2.ckey)
|
||||
set name = "Fire Pod Weapons"
|
||||
set desc = "Fire the weapons."
|
||||
set category = "Spacepod"
|
||||
set src = usr.loc
|
||||
equipment_system.weapon_system.fire_weapons()
|
||||
else
|
||||
return
|
||||
else
|
||||
if(!CheckIfOccupant2(usr))
|
||||
set name = "Fire Pod Weapons"
|
||||
set desc = "Fire the weapons."
|
||||
set category = "Spacepod"
|
||||
@@ -735,35 +762,20 @@
|
||||
equipment_system.weapon_system.fire_weapons()
|
||||
|
||||
obj/spacepod/verb/toggleLights()
|
||||
if(src.occupant2)
|
||||
if(usr.ckey != src.occupant2.ckey)
|
||||
set name = "Toggle Lights"
|
||||
set category = "Spacepod"
|
||||
set src = usr.loc
|
||||
if (usr != occupant)
|
||||
return
|
||||
lights = !lights
|
||||
if(lights)
|
||||
SetLuminosity(luminosity + lights_power)
|
||||
else
|
||||
SetLuminosity(luminosity - lights_power)
|
||||
occupant << "Toggled lights [lights?"on":"off"]."
|
||||
return
|
||||
else
|
||||
return
|
||||
set name = "Toggle Lights"
|
||||
set category = "Spacepod"
|
||||
set src = usr.loc
|
||||
if(!CheckIfOccupant2(usr))
|
||||
lightsToggle()
|
||||
|
||||
/obj/spacepod/proc/lightsToggle()
|
||||
lights = !lights
|
||||
if(lights)
|
||||
SetLuminosity(luminosity + lights_power)
|
||||
else
|
||||
set name = "Toggle Lights"
|
||||
set category = "Spacepod"
|
||||
set src = usr.loc
|
||||
if (usr != occupant)
|
||||
return
|
||||
lights = !lights
|
||||
if(lights)
|
||||
SetLuminosity(luminosity + lights_power)
|
||||
else
|
||||
SetLuminosity(luminosity - lights_power)
|
||||
occupant << "Toggled lights [lights?"on":"off"]."
|
||||
return
|
||||
SetLuminosity(luminosity - lights_power)
|
||||
occupant << "Toggled lights [lights?"on":"off"]."
|
||||
return
|
||||
|
||||
/obj/spacepod/proc/enter_after(delay as num, var/mob/user as mob, var/numticks = 5)
|
||||
var/delayfraction = delay/numticks
|
||||
@@ -838,82 +850,60 @@ obj/spacepod/verb/toggleLights()
|
||||
return 1
|
||||
|
||||
/obj/spacepod/relaymove(mob/user, direction)
|
||||
if(src.occupant2)
|
||||
if(user.ckey != src.occupant2.ckey)
|
||||
var/moveship = 1
|
||||
if(battery && battery.charge >= 3 && health)
|
||||
src.dir = direction
|
||||
switch(direction)
|
||||
if(1)
|
||||
if(inertia_dir == 2)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(2)
|
||||
if(inertia_dir == 1)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(4)
|
||||
if(inertia_dir == 8)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(8)
|
||||
if(inertia_dir == 4)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(moveship)
|
||||
step(src, direction)
|
||||
if(istype(src.loc, /turf/space))
|
||||
inertia_dir = direction
|
||||
else
|
||||
if(!battery)
|
||||
user << "<span class='warning'>No energy cell detected.</span>"
|
||||
else if(battery.charge < 3)
|
||||
user << "<span class='warning'>Not enough charge left.</span>"
|
||||
else if(!health)
|
||||
user << "<span class='warning'>She's dead, Jim</span>"
|
||||
else
|
||||
user << "<span class='warning'>Unknown error has occurred, yell at pomf.</span>"
|
||||
return 0
|
||||
battery.charge = max(0, battery.charge - 3)
|
||||
else
|
||||
return
|
||||
if(!CheckIfOccupant2(user))
|
||||
handlerelaymove(user, direction)
|
||||
|
||||
else
|
||||
var/moveship = 1
|
||||
if(battery && battery.charge >= 3 && health)
|
||||
src.dir = direction
|
||||
switch(direction)
|
||||
if(1)
|
||||
if(inertia_dir == 2)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(2)
|
||||
if(inertia_dir == 1)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(4)
|
||||
if(inertia_dir == 8)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(8)
|
||||
if(inertia_dir == 4)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(moveship)
|
||||
step(src, direction)
|
||||
if(istype(src.loc, /turf/space))
|
||||
inertia_dir = direction
|
||||
return
|
||||
|
||||
/obj/spacepod/proc/handlerelaymove(mob/user, direction)
|
||||
var/moveship = 1
|
||||
if(battery && battery.charge >= 3 && health && empcounter == 0)
|
||||
src.dir = direction
|
||||
switch(direction)
|
||||
if(1)
|
||||
if(inertia_dir == 2)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(2)
|
||||
if(inertia_dir == 1)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(4)
|
||||
if(inertia_dir == 8)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(8)
|
||||
if(inertia_dir == 4)
|
||||
inertia_dir = 0
|
||||
moveship = 0
|
||||
if(moveship)
|
||||
step(src, direction)
|
||||
if(istype(src.loc, /turf/space))
|
||||
inertia_dir = direction
|
||||
else
|
||||
if(!battery)
|
||||
user << "<span class='warning'>No energy cell detected.</span>"
|
||||
else if(battery.charge < 3)
|
||||
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
|
||||
battery.charge = max(0, battery.charge - 3)
|
||||
|
||||
/obj/spacepod/proc/CheckIfOccupant2(mob/user)
|
||||
if(!src.occupant2)
|
||||
return 0
|
||||
if(src.occupant2)
|
||||
if(user == src.occupant2)
|
||||
return 1
|
||||
else
|
||||
if(!battery)
|
||||
user << "<span class='warning'>No energy cell detected.</span>"
|
||||
else if(battery.charge < 3)
|
||||
user << "<span class='warning'>Not enough charge left.</span>"
|
||||
else if(!health)
|
||||
user << "<span class='warning'>She's dead, Jim</span>"
|
||||
else
|
||||
user << "<span class='warning'>Unknown error has occurred, yell at pomf.</span>"
|
||||
return 0
|
||||
battery.charge = max(0, battery.charge - 3)
|
||||
|
||||
|
||||
/obj/effect/landmark/spacepod/random
|
||||
name = "spacepod spawner"
|
||||
|
||||
Reference in New Issue
Block a user