Skip to content

Commit

Permalink
negative shuttle timers? not on my watch maybe. also fuck magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
d3athrow committed Dec 3, 2024
1 parent d994464 commit cedd614
Showing 1 changed file with 49 additions and 50 deletions.
99 changes: 49 additions & 50 deletions code/controllers/shuttle_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var/global/datum/emergency_shuttle/emergency_shuttle
/datum/emergency_shuttle
var/alert = 0 //0 = emergency, 1 = crew cycle

var/location = 0 //0 = in transit (or on standby), 1 = at the station, 2 = at centcom
var/location = 0 //0 = in transit (or on standby) [SHUTTLE_ON_STANDBY], 1 = at the station [SHUTTLE_ON_STATION], 2 = at centcom [SHUTTLE_ON_CENTCOM]
var/online = 0
var/direction = 0 //-1 = going back to centcom (recalled), 0 = on standby, 1 = going to the station, 2 = in transit to centcom (not recalled)

Expand Down Expand Up @@ -59,11 +59,11 @@ var/global/datum/emergency_shuttle/emergency_shuttle
if((!universe.OnShuttleCall(null) || deny_shuttle) && alert == 1) //crew transfer shuttle does not gets recalled by gamemode
return
if(endtime)
setdirection(1)
setdirection(EMERGENCY_SHUTTLE_GOING_TO_STATION)
else
settimeleft(SHUTTLEARRIVETIME*coeff)
online = 1
setdirection(1)
setdirection(EMERGENCY_SHUTTLE_GOING_TO_STATION)
if(always_fake_recall)
fake_recall = rand(300,500)
//turning on the red lights in hallways
Expand All @@ -83,22 +83,22 @@ var/global/datum/emergency_shuttle/emergency_shuttle
return
if(!can_recall)
return
if(direction == 1)
if(direction == EMERGENCY_SHUTTLE_GOING_TO_STATION)
var/timeleft = timeleft()
if(alert == 0)
if(timeleft >= 600)
return
command_alert(/datum/command_alert/emergency_shuttle_recalled)
world << sound('sound/AI/shuttlerecalled.ogg')
setdirection(-1)
setdirection(EMERGENCY_SHUTTLE_RECALLED)
online = 1
for(var/area/A in areas)
if(istype(A, /area/hallway))
A.readyreset()
return
else //makes it possible to send shuttle back.
captain_announce("The shuttle has been recalled.")
setdirection(-1)
setdirection(EMERGENCY_SHUTTLE_RECALLED)
online = 1
return

Expand Down Expand Up @@ -176,8 +176,8 @@ var/global/datum/emergency_shuttle/emergency_shuttle
online=0
shutdown=1

if(direction == 2)
location = 1
if(direction == EMERGENCY_SHUTTLE_GOING_TO_CENTCOMM)
location = SHUTTLE_ON_STATION

//main shuttle
if(shuttle && istype(shuttle,/datum/shuttle/escape))
Expand Down Expand Up @@ -240,7 +240,7 @@ var/global/datum/emergency_shuttle/emergency_shuttle
/datum/emergency_shuttle/proc/shuttle_phase(var/phase, var/casual = 1)
switch (phase)
if ("station")
location = 1
location = SHUTTLE_ON_STATION

if(shuttle && istype(shuttle,/datum/shuttle/escape))
var/datum/shuttle/escape/E = shuttle
Expand All @@ -266,18 +266,18 @@ var/global/datum/emergency_shuttle/emergency_shuttle
to_chat(world, "<span class='sinister' style='font-size:3'> A vile force of darkness is making its way toward the escape shuttle.</span>")
*/
if ("transit")
location = 0 // in deep space
location = SHUTTLE_ON_STANDBY // in deep space

for(var/obj/machinery/door/unpowered/shuttle/D in shuttle.linked_area)
spawn(0)
D.close()
D.locked = 1

if (casual)
direction = 1
direction = EMERGENCY_SHUTTLE_GOING_TO_STATION
else
departed = 1 // It's going!
direction = 2 // heading to centcom
direction = EMERGENCY_SHUTTLE_GOING_TO_CENTCOMM // heading to centcom
settimeleft(SHUTTLETRANSITTIME)

command_alert(/datum/command_alert/emergency_shuttle_left)
Expand Down Expand Up @@ -307,11 +307,11 @@ var/global/datum/emergency_shuttle/emergency_shuttle

if ("centcom")
if (casual)
location = 0
direction = 0
location = SHUTTLE_ON_STANDBY
direction = EMERGENCY_SHUTTLE_STANDBY
else
vote_preload()
location = 2
location = EMERGENCY_SHUTTLE_GOING_TO_CENTCOMM

//if the crew brought items ordered by centcom with them, they get paid for those as if it were the supply shuttle
for(var/atom/movable/MA in shuttle.linked_area)
Expand Down Expand Up @@ -361,10 +361,22 @@ var/global/datum/emergency_shuttle/emergency_shuttle
warmup_sound = 0

switch(location)
if(0)
if(SHUTTLE_ON_STANDBY)

/* --- Shuttle is in transit toward centcom --- */
if(direction == 2)
if(direction == EMERGENCY_SHUTTLE_GOING_TO_CENTCOMM)
if(timeleft <= 0)
/* --- Shuttle has arrived at centcom --- */

//main shuttle
shuttle_phase("centcom",0)

//pods
for (var/pod in escape_pods)
move_pod(pod, "centcom")

hyperspace_sounds("end")
return 1
for(var/obj/structure/shuttle/engine/propulsion/P in shuttle.linked_area)
spawn()
P.shoot_exhaust(backward = 3)
Expand All @@ -378,24 +390,10 @@ var/global/datum/emergency_shuttle/emergency_shuttle
if(collision_imminent)
playsound(shuttle.linked_port, 'sound/misc/weather_warning.ogg', 80, 0, 7, 0, 0)

if(timeleft>0)
return 0

/* --- Shuttle has arrived at centcom --- */
else
return 0



//main shuttle
shuttle_phase("centcom",0)

//pods
for (var/pod in escape_pods)
move_pod(pod, "centcom")

hyperspace_sounds("end")
return 1

/* --- Shuttle has docked centcom after being recalled --- */
if(timeleft>timelimit)
online = 0
Expand All @@ -415,25 +413,9 @@ var/global/datum/emergency_shuttle/emergency_shuttle
shuttle_phase("station",0)
return 1

if(1)
if(timeleft <= 6 && !warmup_sound)
warmup_sound = 1
hyperspace_sounds("begin")
// Just before it leaves, close the damn doors!
if(timeleft == 2 || timeleft == 1)
for(var/obj/machinery/door/unpowered/shuttle/D in shuttle.linked_area)
spawn(0)
D.close()
D.locked = 1
for(var/obj/structure/shuttle/engine/propulsion/P in shuttle.linked_area)
spawn()
P.shoot_exhaust(backward = 3)

if(timeleft>0)
return 0

if(SHUTTLE_ON_STATION)
if(timeleft <= 0)
/* --- Shuttle leaves the station, enters transit --- */
else

//main shuttle
shuttle_phase ("transit",0)
Expand All @@ -447,6 +429,23 @@ var/global/datum/emergency_shuttle/emergency_shuttle

return 1

else if(timeleft <= 2) // Just before it leaves, close the damn doors!
for(var/obj/machinery/door/unpowered/shuttle/D in shuttle.linked_area)
spawn(0)
D.close()
D.locked = 1
for(var/obj/structure/shuttle/engine/propulsion/P in shuttle.linked_area)
spawn()
P.shoot_exhaust(backward = 3)

else if(timeleft <= 6 && !warmup_sound)
warmup_sound = 1
hyperspace_sounds("begin")

else
return 0


else
return 1

Expand Down

0 comments on commit cedd614

Please sign in to comment.