negative shuttle timers? not on my watch maybe. also fuck magic numbers

This commit is contained in:
D3athrow
2024-12-02 21:10:52 -06:00
parent d9944649c3
commit cedd614a0c

View File

@@ -18,7 +18,7 @@ var/global/datum/emergency_shuttle/emergency_shuttle
/datum/emergency_shuttle /datum/emergency_shuttle
var/alert = 0 //0 = emergency, 1 = crew cycle 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/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) var/direction = 0 //-1 = going back to centcom (recalled), 0 = on standby, 1 = going to the station, 2 = in transit to centcom (not recalled)
@@ -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 if((!universe.OnShuttleCall(null) || deny_shuttle) && alert == 1) //crew transfer shuttle does not gets recalled by gamemode
return return
if(endtime) if(endtime)
setdirection(1) setdirection(EMERGENCY_SHUTTLE_GOING_TO_STATION)
else else
settimeleft(SHUTTLEARRIVETIME*coeff) settimeleft(SHUTTLEARRIVETIME*coeff)
online = 1 online = 1
setdirection(1) setdirection(EMERGENCY_SHUTTLE_GOING_TO_STATION)
if(always_fake_recall) if(always_fake_recall)
fake_recall = rand(300,500) fake_recall = rand(300,500)
//turning on the red lights in hallways //turning on the red lights in hallways
@@ -83,14 +83,14 @@ var/global/datum/emergency_shuttle/emergency_shuttle
return return
if(!can_recall) if(!can_recall)
return return
if(direction == 1) if(direction == EMERGENCY_SHUTTLE_GOING_TO_STATION)
var/timeleft = timeleft() var/timeleft = timeleft()
if(alert == 0) if(alert == 0)
if(timeleft >= 600) if(timeleft >= 600)
return return
command_alert(/datum/command_alert/emergency_shuttle_recalled) command_alert(/datum/command_alert/emergency_shuttle_recalled)
world << sound('sound/AI/shuttlerecalled.ogg') world << sound('sound/AI/shuttlerecalled.ogg')
setdirection(-1) setdirection(EMERGENCY_SHUTTLE_RECALLED)
online = 1 online = 1
for(var/area/A in areas) for(var/area/A in areas)
if(istype(A, /area/hallway)) if(istype(A, /area/hallway))
@@ -98,7 +98,7 @@ var/global/datum/emergency_shuttle/emergency_shuttle
return return
else //makes it possible to send shuttle back. else //makes it possible to send shuttle back.
captain_announce("The shuttle has been recalled.") captain_announce("The shuttle has been recalled.")
setdirection(-1) setdirection(EMERGENCY_SHUTTLE_RECALLED)
online = 1 online = 1
return return
@@ -176,8 +176,8 @@ var/global/datum/emergency_shuttle/emergency_shuttle
online=0 online=0
shutdown=1 shutdown=1
if(direction == 2) if(direction == EMERGENCY_SHUTTLE_GOING_TO_CENTCOMM)
location = 1 location = SHUTTLE_ON_STATION
//main shuttle //main shuttle
if(shuttle && istype(shuttle,/datum/shuttle/escape)) if(shuttle && istype(shuttle,/datum/shuttle/escape))
@@ -240,7 +240,7 @@ var/global/datum/emergency_shuttle/emergency_shuttle
/datum/emergency_shuttle/proc/shuttle_phase(var/phase, var/casual = 1) /datum/emergency_shuttle/proc/shuttle_phase(var/phase, var/casual = 1)
switch (phase) switch (phase)
if ("station") if ("station")
location = 1 location = SHUTTLE_ON_STATION
if(shuttle && istype(shuttle,/datum/shuttle/escape)) if(shuttle && istype(shuttle,/datum/shuttle/escape))
var/datum/shuttle/escape/E = shuttle var/datum/shuttle/escape/E = shuttle
@@ -266,7 +266,7 @@ 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>") 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") 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) for(var/obj/machinery/door/unpowered/shuttle/D in shuttle.linked_area)
spawn(0) spawn(0)
@@ -274,10 +274,10 @@ var/global/datum/emergency_shuttle/emergency_shuttle
D.locked = 1 D.locked = 1
if (casual) if (casual)
direction = 1 direction = EMERGENCY_SHUTTLE_GOING_TO_STATION
else else
departed = 1 // It's going! departed = 1 // It's going!
direction = 2 // heading to centcom direction = EMERGENCY_SHUTTLE_GOING_TO_CENTCOMM // heading to centcom
settimeleft(SHUTTLETRANSITTIME) settimeleft(SHUTTLETRANSITTIME)
command_alert(/datum/command_alert/emergency_shuttle_left) command_alert(/datum/command_alert/emergency_shuttle_left)
@@ -307,11 +307,11 @@ var/global/datum/emergency_shuttle/emergency_shuttle
if ("centcom") if ("centcom")
if (casual) if (casual)
location = 0 location = SHUTTLE_ON_STANDBY
direction = 0 direction = EMERGENCY_SHUTTLE_STANDBY
else else
vote_preload() 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 //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) for(var/atom/movable/MA in shuttle.linked_area)
@@ -361,10 +361,22 @@ var/global/datum/emergency_shuttle/emergency_shuttle
warmup_sound = 0 warmup_sound = 0
switch(location) switch(location)
if(0) if(SHUTTLE_ON_STANDBY)
/* --- Shuttle is in transit toward centcom --- */ /* --- 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) for(var/obj/structure/shuttle/engine/propulsion/P in shuttle.linked_area)
spawn() spawn()
P.shoot_exhaust(backward = 3) P.shoot_exhaust(backward = 3)
@@ -378,24 +390,10 @@ var/global/datum/emergency_shuttle/emergency_shuttle
if(collision_imminent) if(collision_imminent)
playsound(shuttle.linked_port, 'sound/misc/weather_warning.ogg', 80, 0, 7, 0, 0) playsound(shuttle.linked_port, 'sound/misc/weather_warning.ogg', 80, 0, 7, 0, 0)
if(timeleft>0) return 0
return 0
/* --- Shuttle has arrived at centcom --- */
else
//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 --- */ /* --- Shuttle has docked centcom after being recalled --- */
if(timeleft>timelimit) if(timeleft>timelimit)
online = 0 online = 0
@@ -415,25 +413,9 @@ var/global/datum/emergency_shuttle/emergency_shuttle
shuttle_phase("station",0) shuttle_phase("station",0)
return 1 return 1
if(1) if(SHUTTLE_ON_STATION)
if(timeleft <= 6 && !warmup_sound) if(timeleft <= 0)
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
/* --- Shuttle leaves the station, enters transit --- */ /* --- Shuttle leaves the station, enters transit --- */
else
//main shuttle //main shuttle
shuttle_phase ("transit",0) shuttle_phase ("transit",0)
@@ -447,6 +429,23 @@ var/global/datum/emergency_shuttle/emergency_shuttle
return 1 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 else
return 1 return 1