mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
even better
This commit is contained in:
@@ -34,285 +34,286 @@ datum/shuttle_controller
|
||||
// call the shuttle
|
||||
// if not called before, set the endtime to T+600 seconds
|
||||
// otherwise if outgoing, switch to incoming
|
||||
proc/incall(coeff = 1)
|
||||
if(shutdown) return
|
||||
if((!universe.OnShuttleCall(null) || deny_shuttle) && alert == 1) //crew transfer shuttle does not gets recalled by gamemode
|
||||
return
|
||||
if(endtime)
|
||||
if(direction == -1)
|
||||
setdirection(1)
|
||||
else
|
||||
settimeleft(SHUTTLEARRIVETIME*coeff)
|
||||
online = 1
|
||||
if(always_fake_recall)
|
||||
fake_recall = rand(300,500)
|
||||
//turning on the red lights in hallways
|
||||
datum/shuttle_controller/proc/incall(coeff = 1)
|
||||
if(shutdown) return
|
||||
if((!universe.OnShuttleCall(null) || deny_shuttle) && alert == 1) //crew transfer shuttle does not gets recalled by gamemode
|
||||
return
|
||||
if(endtime)
|
||||
if(direction == -1)
|
||||
setdirection(1)
|
||||
else
|
||||
settimeleft(SHUTTLEARRIVETIME*coeff)
|
||||
online = 1
|
||||
if(always_fake_recall)
|
||||
fake_recall = rand(300,500)
|
||||
//turning on the red lights in hallways
|
||||
if(alert == 0)
|
||||
for(var/area/A in world)
|
||||
if(istype(A, /area/hallway) && !A.lighting_subarea)
|
||||
A.readyalert()
|
||||
|
||||
datum/shuttle_controller/proc/shuttlealert(var/X)
|
||||
if(shutdown) return
|
||||
alert = X
|
||||
|
||||
|
||||
datum/shuttle_controller/proc/force_shutdown()
|
||||
online=0
|
||||
shutdown=1
|
||||
|
||||
|
||||
|
||||
datum/shuttle_controller/proc/recall()
|
||||
if(shutdown) return
|
||||
if(!can_recall) return
|
||||
if(direction == 1)
|
||||
var/timeleft = timeleft()
|
||||
if(alert == 0)
|
||||
if(timeleft >= 600)
|
||||
return
|
||||
captain_announce("The emergency shuttle has been recalled.")
|
||||
world << sound('sound/AI/shuttlerecalled.ogg')
|
||||
setdirection(-1)
|
||||
online = 1
|
||||
for(var/area/A in world)
|
||||
if(istype(A, /area/hallway) && !A.lighting_subarea)
|
||||
A.readyalert()
|
||||
|
||||
proc/shuttlealert(var/X)
|
||||
if(shutdown) return
|
||||
alert = X
|
||||
|
||||
|
||||
proc/force_shutdown()
|
||||
online=0
|
||||
shutdown=1
|
||||
|
||||
|
||||
|
||||
proc/recall()
|
||||
if(shutdown) return
|
||||
if(!can_recall) return
|
||||
if(direction == 1)
|
||||
var/timeleft = timeleft()
|
||||
if(alert == 0)
|
||||
if(timeleft >= 600)
|
||||
return
|
||||
captain_announce("The emergency shuttle has been recalled.")
|
||||
world << sound('sound/AI/shuttlerecalled.ogg')
|
||||
setdirection(-1)
|
||||
online = 1
|
||||
for(var/area/A in world)
|
||||
if(istype(A, /area/hallway) && !A.lighting_subarea)
|
||||
A.readyreset()
|
||||
return
|
||||
else //makes it possible to send shuttle back.
|
||||
captain_announce("The shuttle has been recalled.")
|
||||
setdirection(-1)
|
||||
online = 1
|
||||
return
|
||||
|
||||
// returns the time (in seconds) before shuttle arrival
|
||||
// note if direction = -1, gives a count-up to SHUTTLEARRIVETIME
|
||||
proc/timeleft()
|
||||
|
||||
if(online)
|
||||
var/timeleft = round((endtime - world.timeofday)/10 ,1)
|
||||
if(direction == 1 || direction == 2)
|
||||
return timeleft
|
||||
else
|
||||
return SHUTTLEARRIVETIME-timeleft
|
||||
else
|
||||
return SHUTTLEARRIVETIME
|
||||
|
||||
// sets the time left to a given delay (in seconds)
|
||||
proc/settimeleft(var/delay)
|
||||
endtime = world.timeofday + delay * 10
|
||||
timelimit = delay
|
||||
|
||||
// sets the shuttle direction
|
||||
// 1 = towards SS13, -1 = back to centcom
|
||||
proc/setdirection(var/dirn)
|
||||
if(direction == dirn)
|
||||
A.readyreset()
|
||||
return
|
||||
direction = dirn
|
||||
// if changing direction, flip the timeleft by SHUTTLEARRIVETIME
|
||||
var/ticksleft = endtime - world.timeofday
|
||||
endtime = world.timeofday + (SHUTTLEARRIVETIME*10 - ticksleft)
|
||||
else //makes it possible to send shuttle back.
|
||||
captain_announce("The shuttle has been recalled.")
|
||||
setdirection(-1)
|
||||
online = 1
|
||||
return
|
||||
|
||||
// returns the time (in seconds) before shuttle arrival
|
||||
// note if direction = -1, gives a count-up to SHUTTLEARRIVETIME
|
||||
datum/shuttle_controller/proc/timeleft()
|
||||
|
||||
if(online)
|
||||
var/timeleft = round((endtime - world.timeofday)/10 ,1)
|
||||
if(direction == 1 || direction == 2)
|
||||
return timeleft
|
||||
else
|
||||
return SHUTTLEARRIVETIME-timeleft
|
||||
else
|
||||
return SHUTTLEARRIVETIME
|
||||
|
||||
// sets the time left to a given delay (in seconds)
|
||||
datum/shuttle_controller/proc/settimeleft(var/delay)
|
||||
endtime = world.timeofday + delay * 10
|
||||
timelimit = delay
|
||||
|
||||
// sets the shuttle direction
|
||||
// 1 = towards SS13, -1 = back to centcom
|
||||
datum/shuttle_controller/proc/setdirection(var/dirn)
|
||||
if(direction == dirn)
|
||||
return
|
||||
direction = dirn
|
||||
// if changing direction, flip the timeleft by SHUTTLEARRIVETIME
|
||||
var/ticksleft = endtime - world.timeofday
|
||||
endtime = world.timeofday + (SHUTTLEARRIVETIME*10 - ticksleft)
|
||||
return
|
||||
|
||||
proc/process()
|
||||
datum/shuttle_controller/proc/process()
|
||||
|
||||
proc/move_pod(var/start_type,var/end_type,var/direction,var/open_doors)
|
||||
var/area/start_location=locate(start_type)
|
||||
var/area/end_location=locate(end_type)
|
||||
datum/shuttle_controller/proc/move_pod(var/start_type,var/end_type,var/direction,var/open_doors)
|
||||
var/area/start_location=locate(start_type)
|
||||
var/area/end_location=locate(end_type)
|
||||
|
||||
start_location.move_contents_to(end_location, null, direction)
|
||||
start_location.move_contents_to(end_location, null, direction)
|
||||
|
||||
for(var/obj/machinery/door/D in world)
|
||||
if( get_area(D) == end_location )
|
||||
spawn(0)
|
||||
if(open_doors)
|
||||
D.open()
|
||||
else
|
||||
D.close()
|
||||
for(var/obj/machinery/door/D in all_doors)
|
||||
if( get_area(D) == end_location )
|
||||
spawn(0)
|
||||
if(open_doors)
|
||||
D.open()
|
||||
else
|
||||
D.close()
|
||||
|
||||
for(var/mob/M in end_location)
|
||||
if(M.client)
|
||||
spawn(0)
|
||||
if(M.buckled)
|
||||
shake_camera(M, 4, 1) // buckled, not a lot of shaking
|
||||
else
|
||||
shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM
|
||||
if(istype(M, /mob/living/carbon))
|
||||
if(!M.buckled)
|
||||
M.Weaken(5)
|
||||
for(var/mob/M in end_location)
|
||||
if(M.client)
|
||||
spawn(0)
|
||||
if(M.buckled)
|
||||
shake_camera(M, 4, 1) // buckled, not a lot of shaking
|
||||
else
|
||||
shake_camera(M, 10, 2) // unbuckled, HOLY SHIT SHAKE THE ROOM
|
||||
if(istype(M, /mob/living/carbon))
|
||||
if(!M.buckled)
|
||||
M.Weaken(5)
|
||||
|
||||
|
||||
emergency_shuttle
|
||||
force_shutdown()
|
||||
..()
|
||||
datum/shuttle_controller/emergency_shuttle
|
||||
|
||||
datum/shuttle_controller/emergency_shuttle/force_shutdown()
|
||||
..()
|
||||
if(direction == 2)
|
||||
location = 1
|
||||
|
||||
//main shuttle
|
||||
move_pod(/area/shuttle/escape/transit,/area/shuttle/escape/station,NORTH,1)
|
||||
|
||||
//pods
|
||||
move_pod(/area/shuttle/escape_pod1/transit,/area/shuttle/escape_pod1/station, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod2/transit,/area/shuttle/escape_pod2/station, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod3/transit,/area/shuttle/escape_pod3/station, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod5/transit,/area/shuttle/escape_pod5/station, NORTH,1)
|
||||
|
||||
online = 0
|
||||
|
||||
datum/shuttle_controller/emergency_shuttle/process()
|
||||
if(!online || shutdown)
|
||||
return
|
||||
var/timeleft = timeleft()
|
||||
if(timeleft > 1e5) // midnight rollover protection
|
||||
timeleft = 0
|
||||
if(timeleft < 0) // Sanity
|
||||
timeleft = 0
|
||||
switch(location)
|
||||
if(0)
|
||||
|
||||
/* --- Shuttle is in transit to Central Command from SS13 --- */
|
||||
if(direction == 2)
|
||||
location = 1
|
||||
if(timeleft>0)
|
||||
return 0
|
||||
|
||||
//main shuttle
|
||||
move_pod(/area/shuttle/escape/transit,/area/shuttle/escape/station,NORTH,1)
|
||||
/* --- Shuttle has arrived at Centrcal Command --- */
|
||||
else
|
||||
// turn off the star spawners
|
||||
/*
|
||||
for(var/obj/effect/starspawner/S in world)
|
||||
S.spawning = 0
|
||||
*/
|
||||
|
||||
//pods
|
||||
move_pod(/area/shuttle/escape_pod1/transit,/area/shuttle/escape_pod1/station, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod2/transit,/area/shuttle/escape_pod2/station, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod3/transit,/area/shuttle/escape_pod3/station, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod5/transit,/area/shuttle/escape_pod5/station, NORTH,1)
|
||||
location = 2
|
||||
|
||||
//main shuttle
|
||||
move_pod(/area/shuttle/escape/transit,/area/shuttle/escape/centcom,NORTH,1)
|
||||
|
||||
//pods
|
||||
move_pod(/area/shuttle/escape_pod1/transit,/area/shuttle/escape_pod1/centcom, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod2/transit,/area/shuttle/escape_pod2/centcom, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod3/transit,/area/shuttle/escape_pod3/centcom, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod5/transit,/area/shuttle/escape_pod5/centcom, NORTH,1)
|
||||
|
||||
online = 0
|
||||
|
||||
return 1
|
||||
|
||||
/* --- Shuttle has docked centcom after being recalled --- */
|
||||
if(timeleft>timelimit)
|
||||
online = 0
|
||||
direction = 1
|
||||
endtime = null
|
||||
|
||||
process()
|
||||
if(!online || shutdown)
|
||||
return
|
||||
var/timeleft = timeleft()
|
||||
if(timeleft > 1e5) // midnight rollover protection
|
||||
timeleft = 0
|
||||
if(timeleft < 0) // Sanity
|
||||
timeleft = 0
|
||||
switch(location)
|
||||
if(0)
|
||||
return 0
|
||||
|
||||
/* --- Shuttle is in transit to Central Command from SS13 --- */
|
||||
if(direction == 2)
|
||||
if(timeleft>0)
|
||||
return 0
|
||||
else if((fake_recall != 0) && (timeleft <= fake_recall))
|
||||
recall()
|
||||
fake_recall = 0
|
||||
return 0
|
||||
|
||||
/* --- Shuttle has arrived at Centrcal Command --- */
|
||||
else
|
||||
// turn off the star spawners
|
||||
/*
|
||||
for(var/obj/effect/starspawner/S in world)
|
||||
S.spawning = 0
|
||||
*/
|
||||
/* --- Shuttle has docked with the station - begin countdown to transit --- */
|
||||
else if(timeleft <= 0)
|
||||
location = 1
|
||||
var/area/start_location = locate(/area/shuttle/escape/centcom)
|
||||
var/area/end_location = locate(/area/shuttle/escape/station)
|
||||
|
||||
location = 2
|
||||
var/list/dstturfs = list()
|
||||
var/throwy = world.maxy
|
||||
|
||||
//main shuttle
|
||||
move_pod(/area/shuttle/escape/transit,/area/shuttle/escape/centcom,NORTH,1)
|
||||
for(var/turf/T in end_location)
|
||||
dstturfs += T
|
||||
if(T.y < throwy)
|
||||
throwy = T.y
|
||||
|
||||
//pods
|
||||
move_pod(/area/shuttle/escape_pod1/transit,/area/shuttle/escape_pod1/centcom, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod2/transit,/area/shuttle/escape_pod2/centcom, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod3/transit,/area/shuttle/escape_pod3/centcom, NORTH,1)
|
||||
move_pod(/area/shuttle/escape_pod5/transit,/area/shuttle/escape_pod5/centcom, NORTH,1)
|
||||
|
||||
online = 0
|
||||
|
||||
return 1
|
||||
|
||||
/* --- Shuttle has docked centcom after being recalled --- */
|
||||
if(timeleft>timelimit)
|
||||
online = 0
|
||||
direction = 1
|
||||
endtime = null
|
||||
|
||||
return 0
|
||||
|
||||
else if((fake_recall != 0) && (timeleft <= fake_recall))
|
||||
recall()
|
||||
fake_recall = 0
|
||||
return 0
|
||||
|
||||
/* --- Shuttle has docked with the station - begin countdown to transit --- */
|
||||
else if(timeleft <= 0)
|
||||
location = 1
|
||||
var/area/start_location = locate(/area/shuttle/escape/centcom)
|
||||
var/area/end_location = locate(/area/shuttle/escape/station)
|
||||
|
||||
var/list/dstturfs = list()
|
||||
var/throwy = world.maxy
|
||||
|
||||
for(var/turf/T in end_location)
|
||||
dstturfs += T
|
||||
if(T.y < throwy)
|
||||
throwy = T.y
|
||||
|
||||
// hey you, get out of the way!
|
||||
for(var/turf/T in dstturfs)
|
||||
// find the turf to move things to
|
||||
var/turf/D = locate(T.x, throwy - 1, 1)
|
||||
//var/turf/E = get_step(D, SOUTH)
|
||||
for(var/atom/A as mob|obj in T)
|
||||
if(ismob(A))
|
||||
var/mob/M=A
|
||||
M.gib()
|
||||
else if(istype(A,/atom/movable))
|
||||
var/atom/movable/AM=A
|
||||
AM.Move(D)
|
||||
// Remove windows, grills, lattice, etc.
|
||||
if(istype(A,/obj/structure) || istype(A,/obj/machinery))
|
||||
if(istype(A,/obj/machinery/singularity))
|
||||
continue
|
||||
qdel(A)
|
||||
// NOTE: Commenting this out to avoid recreating mass driver glitch
|
||||
/*
|
||||
spawn(0)
|
||||
AM.throw_at(E, 1, 1)
|
||||
return
|
||||
*/
|
||||
|
||||
if(istype(T, /turf/simulated))
|
||||
del(T)
|
||||
|
||||
start_location.move_contents_to(end_location)
|
||||
settimeleft(SHUTTLELEAVETIME)
|
||||
send2mainirc("The Emergency Shuttle has docked with the station.")
|
||||
captain_announce("The Emergency Shuttle has docked with the station. You have [round(timeleft()/60,1)] minutes to board the Emergency Shuttle.")
|
||||
world << sound('sound/AI/shuttledock.ogg')
|
||||
|
||||
if(universe.name == "Hell Rising")
|
||||
world << "___________________________________________________________________"
|
||||
world << "<span class='sinister' style='font-size:3'> A vile force of darkness is making its way toward the escape shuttle.</span>"
|
||||
|
||||
return 1
|
||||
|
||||
if(1)
|
||||
|
||||
// Just before it leaves, close the damn doors!
|
||||
if(timeleft == 2 || timeleft == 1)
|
||||
var/area/start_location = locate(/area/shuttle/escape/station)
|
||||
for(var/obj/machinery/door/unpowered/shuttle/D in start_location)
|
||||
spawn(0)
|
||||
D.close()
|
||||
D.locked = 1
|
||||
|
||||
if(timeleft>0)
|
||||
return 0
|
||||
|
||||
/* --- Shuttle leaves the station, enters transit --- */
|
||||
else
|
||||
|
||||
// Turn on the star effects
|
||||
|
||||
/* // kinda buggy atm, i'll fix this later
|
||||
for(var/obj/effect/starspawner/S in world)
|
||||
if(!S.spawning)
|
||||
spawn() S.startspawn()
|
||||
// hey you, get out of the way!
|
||||
for(var/turf/T in dstturfs)
|
||||
// find the turf to move things to
|
||||
var/turf/D = locate(T.x, throwy - 1, 1)
|
||||
//var/turf/E = get_step(D, SOUTH)
|
||||
for(var/atom/A as mob|obj in T)
|
||||
if(ismob(A))
|
||||
var/mob/M=A
|
||||
M.gib()
|
||||
else if(istype(A,/atom/movable))
|
||||
var/atom/movable/AM=A
|
||||
AM.Move(D)
|
||||
// Remove windows, grills, lattice, etc.
|
||||
if(istype(A,/obj/structure) || istype(A,/obj/machinery))
|
||||
if(istype(A,/obj/machinery/singularity))
|
||||
continue
|
||||
qdel(A)
|
||||
// NOTE: Commenting this out to avoid recreating mass driver glitch
|
||||
/*
|
||||
spawn(0)
|
||||
AM.throw_at(E, 1, 1)
|
||||
return
|
||||
*/
|
||||
|
||||
departed = 1 // It's going!
|
||||
location = 0 // in deep space
|
||||
direction = 2 // heading to centcom
|
||||
if(istype(T, /turf/simulated))
|
||||
del(T)
|
||||
|
||||
settimeleft(SHUTTLETRANSITTIME)
|
||||
start_location.move_contents_to(end_location)
|
||||
settimeleft(SHUTTLELEAVETIME)
|
||||
send2mainirc("The Emergency Shuttle has docked with the station.")
|
||||
captain_announce("The Emergency Shuttle has docked with the station. You have [round(timeleft()/60,1)] minutes to board the Emergency Shuttle.")
|
||||
world << sound('sound/AI/shuttledock.ogg')
|
||||
|
||||
// Shuttle Radio
|
||||
CallHook("EmergencyShuttleDeparture", list())
|
||||
if(universe.name == "Hell Rising")
|
||||
world << "___________________________________________________________________"
|
||||
world << "<span class='sinister' style='font-size:3'> A vile force of darkness is making its way toward the escape shuttle.</span>"
|
||||
|
||||
//main shuttle
|
||||
move_pod(/area/shuttle/escape/station,/area/shuttle/escape/transit,NORTH,0)
|
||||
return 1
|
||||
|
||||
//pods
|
||||
move_pod(/area/shuttle/escape_pod1/station,/area/shuttle/escape_pod1/transit,NORTH,0)
|
||||
move_pod(/area/shuttle/escape_pod2/station,/area/shuttle/escape_pod2/transit,NORTH,0)
|
||||
move_pod(/area/shuttle/escape_pod3/station,/area/shuttle/escape_pod3/transit,NORTH,0)
|
||||
if(1)
|
||||
|
||||
move_pod(/area/shuttle/escape_pod5/station,/area/shuttle/escape_pod5/transit,EAST,0)
|
||||
// Just before it leaves, close the damn doors!
|
||||
if(timeleft == 2 || timeleft == 1)
|
||||
var/area/start_location = locate(/area/shuttle/escape/station)
|
||||
for(var/obj/machinery/door/unpowered/shuttle/D in start_location)
|
||||
spawn(0)
|
||||
D.close()
|
||||
D.locked = 1
|
||||
|
||||
captain_announce("The Emergency Shuttle has left the station. Estimate [round(timeleft()/60,1)] minutes until the shuttle docks at Central Command.")
|
||||
if(timeleft>0)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
/* --- Shuttle leaves the station, enters transit --- */
|
||||
else
|
||||
|
||||
else
|
||||
return 1
|
||||
// Turn on the star effects
|
||||
|
||||
/* // kinda buggy atm, i'll fix this later
|
||||
for(var/obj/effect/starspawner/S in world)
|
||||
if(!S.spawning)
|
||||
spawn() S.startspawn()
|
||||
*/
|
||||
|
||||
departed = 1 // It's going!
|
||||
location = 0 // in deep space
|
||||
direction = 2 // heading to centcom
|
||||
|
||||
settimeleft(SHUTTLETRANSITTIME)
|
||||
|
||||
// Shuttle Radio
|
||||
CallHook("EmergencyShuttleDeparture", list())
|
||||
|
||||
//main shuttle
|
||||
move_pod(/area/shuttle/escape/station,/area/shuttle/escape/transit,NORTH,0)
|
||||
|
||||
//pods
|
||||
move_pod(/area/shuttle/escape_pod1/station,/area/shuttle/escape_pod1/transit,NORTH,0)
|
||||
move_pod(/area/shuttle/escape_pod2/station,/area/shuttle/escape_pod2/transit,NORTH,0)
|
||||
move_pod(/area/shuttle/escape_pod3/station,/area/shuttle/escape_pod3/transit,NORTH,0)
|
||||
|
||||
move_pod(/area/shuttle/escape_pod5/station,/area/shuttle/escape_pod5/transit,EAST,0)
|
||||
|
||||
captain_announce("The Emergency Shuttle has left the station. Estimate [round(timeleft()/60,1)] minutes until the shuttle docks at Central Command.")
|
||||
|
||||
return 1
|
||||
|
||||
else
|
||||
return 1
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user