diff --git a/code/_helpers/_global_objects.dm b/code/_helpers/_global_objects.dm index 05233b31636..7957d1f4569 100644 --- a/code/_helpers/_global_objects.dm +++ b/code/_helpers/_global_objects.dm @@ -9,7 +9,6 @@ GLOBAL_DATUM_INIT(global_underwear, /datum/category_collection/underwear, new) // Pipe colors, needs to be inited before our pipe icon_manager GLOBAL_LIST_INIT(pipe_colors, list("grey" = PIPE_COLOR_GREY, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "black" = PIPE_COLOR_BLACK, "orange" = PIPE_COLOR_ORANGE, "white" = PIPE_COLOR_WHITE, "purple" = PIPE_COLOR_PURPLE)) GLOBAL_DATUM_INIT(icon_manager, /datum/pipe_icon_manager, new) -GLOBAL_DATUM_INIT(emergency_shuttle, /datum/emergency_shuttle_controller, new) GLOBAL_LIST_EMPTY(comm_message_listeners) //We first have to initialize list then we can use it. GLOBAL_DATUM_INIT(global_message_listener, /datum/comm_message_listener, new) //May be used by admins diff --git a/code/_helpers/roundend.dm b/code/_helpers/roundend.dm index 292404960ab..e652471d28f 100644 --- a/code/_helpers/roundend.dm +++ b/code/_helpers/roundend.dm @@ -15,7 +15,7 @@ if(Player.mind && !isnewplayer(Player)) if(Player.stat != DEAD) var/turf/playerTurf = get_turf(Player) - if(GLOB.emergency_shuttle.departed && GLOB.emergency_shuttle.evac) + if(SSemergency_shuttle.departed && SSemergency_shuttle.evac) if(isNotAdminLevel(playerTurf.z)) to_chat(Player, span_filter_system(span_blue(span_bold("You survived the round, but remained on [station_name()] as [Player.real_name].")))) else diff --git a/code/controllers/admin.dm b/code/controllers/admin.dm index 6e87ce01dbe..ab1ed07af85 100644 --- a/code/controllers/admin.dm +++ b/code/controllers/admin.dm @@ -79,7 +79,6 @@ ADMIN_VERB(debug_controller, R_DEBUG, "Debug Controller", "Debug the various per //Goon PS stuff, and other yet-to-be-subsystem things. options["LEGACY: master_controller"] = GLOB.master_controller options["LEGACY: job_master"] = GLOB.job_master - options["LEGACY: emergency_shuttle"] = GLOB.emergency_shuttle options["LEGACY: cameranet"] = GLOB.cameranet var/pick = tgui_input_list(user, "Choose a controller to debug/view variables of.", "VV controller:", options) diff --git a/code/controllers/emergency_shuttle_controller.dm b/code/controllers/emergency_shuttle_controller.dm deleted file mode 100644 index 81d7acb0f4e..00000000000 --- a/code/controllers/emergency_shuttle_controller.dm +++ /dev/null @@ -1,292 +0,0 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 - -// Controls the emergency shuttle - -/datum/emergency_shuttle_controller - var/datum/shuttle/autodock/ferry/emergency/shuttle // Set in shuttle_emergency.dm TODO - is it really? - var/list/escape_pods - - var/launch_time //the time at which the shuttle will be launched - var/auto_recall = 0 //if set, the shuttle will be auto-recalled - var/auto_recall_time //the time at which the shuttle will be auto-recalled - var/evac = 0 //1 = emergency evacuation, 0 = crew transfer - var/wait_for_launch = 0 //if the shuttle is waiting to launch - var/autopilot = 1 //set to 0 to disable the shuttle automatically launching - - var/deny_shuttle = 0 //allows admins to prevent the shuttle from being called - var/departed = 0 //if the shuttle has left the station at least once - - var/datum/announcement/priority/emergency_shuttle_docked - var/datum/announcement/priority/emergency_shuttle_called - var/datum/announcement/priority/emergency_shuttle_recalled - -/datum/emergency_shuttle_controller/New() - emergency_shuttle_docked = new(0, new_sound = sound('sound/AI/shuttledock.ogg')) - emergency_shuttle_called = new(0, new_sound = sound('sound/AI/shuttlecalled.ogg')) - emergency_shuttle_recalled = new(0, new_sound = sound('sound/AI/shuttlerecalled.ogg')) - escape_pods = list() - ..() - -/datum/emergency_shuttle_controller/process() - if (wait_for_launch) - if (evac && auto_recall && world.time >= auto_recall_time) - recall() - if (world.time >= launch_time) //time to launch the shuttle - stop_launch_countdown() - - if (!shuttle.location) //leaving from the station - //launch the pods! - for (var/EP in escape_pods) - var/datum/shuttle/autodock/ferry/escape_pod/pod - if(istype(escape_pods[EP], /datum/shuttle/autodock/ferry/escape_pod)) - pod = escape_pods[EP] - else - continue - if (!pod.arming_controller || pod.arming_controller.armed) - pod.launch(src) - - if (autopilot) - shuttle.launch(src) - -//called when the shuttle has arrived. - -/datum/emergency_shuttle_controller/proc/shuttle_arrived() - if (!shuttle.location) //at station - if (autopilot) - set_launch_countdown(SHUTTLE_LEAVETIME) //get ready to return - var/estimated_time = round(estimate_launch_time()/60,1) - - if (evac) - emergency_shuttle_docked.Announce(replacetext(replacetext(using_map.emergency_shuttle_docked_message, "%dock_name%", "[using_map.dock_name]"), "%ETD%", "[estimated_time] minute\s")) - else - GLOB.priority_announcement.Announce(replacetext(replacetext(using_map.shuttle_docked_message, "%dock_name%", "[using_map.dock_name]"), "%ETD%", "[estimated_time] minute\s"), "Transfer System", 'sound/AI/tramarrived.ogg') //VOREStation Edit - TTS - - //arm the escape pods - if (evac) - for (var/EP in escape_pods) - var/datum/shuttle/autodock/ferry/escape_pod/pod - if(istype(escape_pods[EP], /datum/shuttle/autodock/ferry/escape_pod)) - pod = escape_pods[EP] - else - continue - if (pod.arming_controller) - pod.arming_controller.arm() - -//begins the launch countdown and sets the amount of time left until launch -/datum/emergency_shuttle_controller/proc/set_launch_countdown(var/seconds) - wait_for_launch = 1 - launch_time = world.time + seconds*10 - START_PROCESSING(SSprocessing, src) - -/datum/emergency_shuttle_controller/proc/stop_launch_countdown() - STOP_PROCESSING(SSprocessing, src) - wait_for_launch = 0 - -//calls the shuttle for an emergency evacuation -/datum/emergency_shuttle_controller/proc/call_evac() - if(!can_call()) return - - //set the launch timer - autopilot = 1 - set_launch_countdown(get_shuttle_prep_time()) - auto_recall_time = rand(world.time + 300, launch_time - 300) - - //reset the shuttle transit time if we need to - shuttle.move_time = SHUTTLE_TRANSIT_DURATION - var/estimated_time = round(estimate_arrival_time()/60,1) - - evac = 1 - emergency_shuttle_called.Announce(replacetext(using_map.emergency_shuttle_called_message, "%ETA%", "[estimated_time] minute\s")) - for(var/area/A in world) - if(istype(A, /area/hallway)) - A.readyalert() - - SSatc.reroute_traffic(yes = 1) - -//calls the shuttle for a routine crew transfer -/datum/emergency_shuttle_controller/proc/call_transfer() - if(!can_call()) return - - //set the launch timer - autopilot = 1 - set_launch_countdown(get_shuttle_prep_time()) - auto_recall_time = rand(world.time + 300, launch_time - 300) - - //reset the shuttle transit time if we need to - shuttle.move_time = SHUTTLE_TRANSIT_DURATION - var/estimated_time = round(estimate_arrival_time()/60,1) - - GLOB.priority_announcement.Announce(replacetext(replacetext(using_map.shuttle_called_message, "%dock_name%", "[using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s"), "Transfer System", 'sound/AI/tramcalled.ogg') - SSatc.shift_ending() - -//recalls the shuttle -/datum/emergency_shuttle_controller/proc/recall() - if (!can_recall()) return - - stop_launch_countdown() - shuttle.cancel_launch(src) - - if (evac) - emergency_shuttle_recalled.Announce(using_map.emergency_shuttle_recall_message) - - for(var/area/A in world) - if(istype(A, /area/hallway)) - A.readyreset() - evac = 0 - else - GLOB.priority_announcement.Announce(using_map.shuttle_recall_message) - -/datum/emergency_shuttle_controller/proc/can_call() - if (!GLOB.universe.OnShuttleCall(null)) - return 0 - if (deny_shuttle) - return 0 - if (shuttle.moving_status != SHUTTLE_IDLE || !shuttle.location) //must be idle at centcom - return 0 - if (wait_for_launch) //already launching - return 0 - return 1 - -//this only returns 0 if it would absolutely make no sense to recall -//e.g. the shuttle is already at the station or wasn't called to begin with -//other reasons for the shuttle not being recallable should be handled elsewhere -/datum/emergency_shuttle_controller/proc/can_recall() - if (shuttle.moving_status == SHUTTLE_INTRANSIT) //if the shuttle is already in transit then it's too late - return 0 - if (!shuttle.location) //already at the station. - return 0 - if (!wait_for_launch) //we weren't going anywhere, anyways... - return 0 - return 1 - -/datum/emergency_shuttle_controller/proc/get_shuttle_prep_time() - // During mutiny rounds, the shuttle takes twice as long. - if(SSticker && SSticker.mode) - return SHUTTLE_PREPTIME * SSticker.mode.shuttle_delay - return SHUTTLE_PREPTIME - - -/* - These procs are not really used by the controller itself, but are for other parts of the - game whose logic depends on the emergency shuttle. -*/ - -//returns 1 if the shuttle is docked at the station and waiting to leave -/datum/emergency_shuttle_controller/proc/waiting_to_leave() - if (shuttle.location) - return 0 //not at station - return (wait_for_launch || shuttle.moving_status != SHUTTLE_INTRANSIT) - -//so we don't have GLOB.emergency_shuttle.shuttle.location everywhere -/datum/emergency_shuttle_controller/proc/location() - if (!shuttle) - return 1 //if we dont have a shuttle datum, just act like it's at centcom - return shuttle.location - -//returns the time left until the shuttle arrives at it's destination, in seconds -/datum/emergency_shuttle_controller/proc/estimate_arrival_time() - var/eta - if (shuttle.has_arrive_time()) - //we are in transition and can get an accurate ETA - eta = shuttle.arrive_time - else - //otherwise we need to estimate the arrival time using the scheduled launch time - eta = launch_time + shuttle.move_time*10 + shuttle.warmup_time*10 - return (eta - world.time)/10 - -//returns the time left until the shuttle launches, in seconds -/datum/emergency_shuttle_controller/proc/estimate_launch_time() - return (launch_time - world.time)/10 - -/datum/emergency_shuttle_controller/proc/has_eta() - return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) - -//returns 1 if the shuttle has gone to the station and come back at least once, -//used for game completion checking purposes -/datum/emergency_shuttle_controller/proc/returned() - return (departed && shuttle.moving_status == SHUTTLE_IDLE && shuttle.location) //we've gone to the station at least once, no longer in transit and are idle back at centcom - -//returns 1 if the shuttle is not idle at centcom -/datum/emergency_shuttle_controller/proc/online() - if(!shuttle) - return FALSE - if (!shuttle.location) //not at centcom - return 1 - if (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) - return 1 - return 0 - -//returns 1 if the shuttle is currently in transit (or just leaving) to the station -/datum/emergency_shuttle_controller/proc/going_to_station() - return shuttle && (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) - -//returns 1 if the shuttle is currently in transit (or just leaving) to centcom -/datum/emergency_shuttle_controller/proc/going_to_centcom() - return shuttle && (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) - - -/datum/emergency_shuttle_controller/proc/get_status_panel_eta() - if (online()) - if (shuttle.has_arrive_time()) - var/timeleft = GLOB.emergency_shuttle.estimate_arrival_time() - return "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]" - - if (waiting_to_leave()) - if (shuttle.moving_status == SHUTTLE_WARMUP) - return "Departing..." - - var/timeleft = GLOB.emergency_shuttle.estimate_launch_time() - return "ETD-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]" - - return "" -/* - Some slapped-together star effects for maximum spess immershuns. Basically consists of a - spawner, an ender, and bgstar. Spawners create bgstars, bgstars shoot off into a direction - until they reach a starender. -*/ - -/obj/effect/bgstar - name = "star" - var/speed = 10 - var/direction = SOUTH - layer = TURF_LAYER - plane = TURF_PLANE - -/obj/effect/bgstar/Initialize(mapload) - . = ..() - pixel_x += rand(-2,30) - pixel_y += rand(-2,30) - var/starnum = pick("1", "1", "1", "2", "3", "4") - - icon_state = "star"+starnum - - speed = rand(2, 5) - -/obj/effect/bgstar/proc/startmove() - - while(src) - sleep(speed) - step(src, direction) - for(var/obj/effect/starender/E in loc) - qdel(src) - return - -/obj/effect/starender - invisibility = INVISIBILITY_ABSTRACT - -/obj/effect/starspawner - invisibility = INVISIBILITY_ABSTRACT - var/spawndir = SOUTH - var/spawning = 0 - -/obj/effect/starspawner/West - spawndir = WEST - -/obj/effect/starspawner/proc/startspawn() - spawning = 1 - while(spawning) - sleep(rand(2, 30)) - var/obj/effect/bgstar/S = new/obj/effect/bgstar(locate(x,y,z)) - S.direction = spawndir - spawn() - S.startmove() diff --git a/code/controllers/subsystems/emergency_shuttle.dm b/code/controllers/subsystems/emergency_shuttle.dm new file mode 100644 index 00000000000..eeca0931cf5 --- /dev/null +++ b/code/controllers/subsystems/emergency_shuttle.dm @@ -0,0 +1,261 @@ +//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 + +// Controls the emergency shuttle +SUBSYSTEM_DEF(emergency_shuttle) + can_fire = FALSE + name = "Emergency Shuttle" + wait = 1 SECOND + runlevels = RUNLEVEL_GAME + init_stage = INITSTAGE_LAST + flags = SS_KEEP_TIMING + + var/datum/shuttle/autodock/ferry/emergency/shuttle // Set in shuttle_emergency.dm TODO - is it really? + var/list/escape_pods = list() + + var/launch_time //the time at which the shuttle will be launched + var/auto_recall = FALSE //if set, the shuttle will be auto-recalled + var/evac = FALSE //1 = emergency evacuation, 0 = crew transfer + var/wait_for_launch = FALSE //if the shuttle is waiting to launch + var/autopilot = TRUE //set to 0 to disable the shuttle automatically launching + + var/deny_shuttle = FALSE //allows admins to prevent the shuttle from being called + var/departed = FALSE //if the shuttle has left the station at least once + + VAR_PRIVATE/auto_recall_time //the time at which the shuttle will be auto-recalled + VAR_PRIVATE/datum/announcement/priority/emergency_shuttle_docked + VAR_PRIVATE/datum/announcement/priority/emergency_shuttle_called + VAR_PRIVATE/datum/announcement/priority/emergency_shuttle_recalled + VAR_PRIVATE/list/current_run + +/datum/controller/subsystem/emergency_shuttle/Initialize() + emergency_shuttle_docked = new(0, new_sound = sound('sound/AI/shuttledock.ogg')) + emergency_shuttle_called = new(0, new_sound = sound('sound/AI/shuttlecalled.ogg')) + emergency_shuttle_recalled = new(0, new_sound = sound('sound/AI/shuttlerecalled.ogg')) + return SS_INIT_SUCCESS + +/datum/controller/subsystem/emergency_shuttle/fire(resumed) + if(!resumed) + if(!wait_for_launch) + return + + if(evac && auto_recall && world.time >= auto_recall_time) + recall() + if(world.time >= launch_time) //time to launch the shuttle + stop_launch_countdown() + + if(!shuttle.location) //leaving from the station + //launch the pods! + current_run = escape_pods.Copy() + + if(autopilot) + shuttle.launch(src) + + while(length(current_run)) + if(MC_TICK_CHECK) + return + var/escape_pod = current_run[length(current_run)] + current_run.len-- + var/datum/shuttle/autodock/ferry/escape_pod/pod = escape_pods[escape_pod] + if(!istype(pod, /datum/shuttle/autodock/ferry/escape_pod)) + continue + if(!pod.arming_controller || pod.arming_controller.armed) + pod.launch(src) + +//called when the shuttle has arrived. + +/datum/controller/subsystem/emergency_shuttle/proc/shuttle_arrived() + if(shuttle.location) //at station + return + + if(autopilot) + set_launch_countdown(SHUTTLE_LEAVETIME) //get ready to return + var/estimated_time = round(estimate_launch_time()/60,1) + + if(evac) + emergency_shuttle_docked.Announce(replacetext(replacetext(using_map.emergency_shuttle_docked_message, "%dock_name%", "[using_map.dock_name]"), "%ETD%", "[estimated_time] minute\s")) + else + GLOB.priority_announcement.Announce(replacetext(replacetext(using_map.shuttle_docked_message, "%dock_name%", "[using_map.dock_name]"), "%ETD%", "[estimated_time] minute\s"), "Transfer System", 'sound/AI/tramarrived.ogg') //VOREStation Edit - TTS + + //arm the escape pods + if(!evac) + return + + for(var/key, value in escape_pods) + var/datum/shuttle/autodock/ferry/escape_pod/pod = value + if(!istype(pod, /datum/shuttle/autodock/ferry/escape_pod)) + continue + if(pod.arming_controller) + pod.arming_controller.arm() + +//begins the launch countdown and sets the amount of time left until launch +/datum/controller/subsystem/emergency_shuttle/proc/set_launch_countdown(var/seconds) + wait_for_launch = TRUE + launch_time = world.time + (seconds * 10) + can_fire = TRUE + next_fire = world.time + wait + +/datum/controller/subsystem/emergency_shuttle/proc/stop_launch_countdown() + can_fire = FALSE + wait_for_launch = FALSE + +//calls the shuttle for an emergency evacuation +/datum/controller/subsystem/emergency_shuttle/proc/call_evac() + if(!can_call()) + return + + //set the launch timer + autopilot = TRUE + set_launch_countdown(get_shuttle_prep_time()) + auto_recall_time = rand(world.time + 300, launch_time - 300) + + //reset the shuttle transit time if we need to + shuttle.move_time = SHUTTLE_TRANSIT_DURATION + var/estimated_time = round(estimate_arrival_time()/60, 1) + + evac = TRUE + emergency_shuttle_called.Announce(replacetext(using_map.emergency_shuttle_called_message, "%ETA%", "[estimated_time] minute\s")) + for(var/type, area in GLOB.areas_by_type) + if(istype(area, /area/hallway)) + var/area/hallway/our_hallway = area + our_hallway.readyalert() + + SSatc.reroute_traffic(yes = 1) + +//calls the shuttle for a routine crew transfer +/datum/controller/subsystem/emergency_shuttle/proc/call_transfer() + if(!can_call()) + return + + //set the launch timer + autopilot = TRUE + set_launch_countdown(get_shuttle_prep_time()) + auto_recall_time = rand(world.time + 300, launch_time - 300) + + //reset the shuttle transit time if we need to + shuttle.move_time = SHUTTLE_TRANSIT_DURATION + var/estimated_time = round(estimate_arrival_time()/60, 1) + + GLOB.priority_announcement.Announce(replacetext(replacetext(using_map.shuttle_called_message, "%dock_name%", "[using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s"), "Transfer System", 'sound/AI/tramcalled.ogg') + SSatc.shift_ending() + +//recalls the shuttle +/datum/controller/subsystem/emergency_shuttle/proc/recall() + if(!can_recall()) + return + + stop_launch_countdown() + shuttle.cancel_launch(src) + + if(evac) + emergency_shuttle_recalled.Announce(using_map.emergency_shuttle_recall_message) + + for(var/type, area in GLOB.areas_by_type) + if(istype(area, /area/hallway)) + var/area/hallway/our_hallway = area + our_hallway.readyreset() + evac = FALSE + return + GLOB.priority_announcement.Announce(using_map.shuttle_recall_message) + +/datum/controller/subsystem/emergency_shuttle/proc/can_call() + if(!GLOB.universe.OnShuttleCall(null)) + return FALSE + if(deny_shuttle) + return FALSE + if(shuttle.moving_status != SHUTTLE_IDLE || !shuttle.location) //must be idle at centcom + return FALSE + if(wait_for_launch) //already launching + return FALSE + return TRUE + +//this only returns 0 if it would absolutely make no sense to recall +//e.g. the shuttle is already at the station or wasn't called to begin with +//other reasons for the shuttle not being recallable should be handled elsewhere +/datum/controller/subsystem/emergency_shuttle/proc/can_recall() + if(shuttle.moving_status == SHUTTLE_INTRANSIT) //if the shuttle is already in transit then it's too late + return FALSE + if(!shuttle.location) //already at the station. + return FALSE + if(!wait_for_launch) //we weren't going anywhere, anyways... + return FALSE + return TRUE + +/datum/controller/subsystem/emergency_shuttle/proc/get_shuttle_prep_time() + // During mutiny rounds, the shuttle takes twice as long. + if(SSticker && SSticker.mode) + return SHUTTLE_PREPTIME * SSticker.mode.shuttle_delay + return SHUTTLE_PREPTIME + + +/* + These procs are not really used by the controller itself, but are for other parts of the + game whose logic depends on the emergency shuttle. +*/ + +//returns 1 if the shuttle is docked at the station and waiting to leave +/datum/controller/subsystem/emergency_shuttle/proc/waiting_to_leave() + if(shuttle.location) + return FALSE //not at station + return (wait_for_launch || shuttle.moving_status != SHUTTLE_INTRANSIT) + +//so we don't have SSemergency_shuttle.shuttle.location everywhere +/datum/controller/subsystem/emergency_shuttle/proc/location() + if(!shuttle) + return 1 //if we dont have a shuttle datum, just act like it's at centcom + return shuttle.location + +//returns the time left until the shuttle arrives at it's destination, in seconds +/datum/controller/subsystem/emergency_shuttle/proc/estimate_arrival_time() + var/eta + if(shuttle.has_arrive_time()) + //we are in transition and can get an accurate ETA + eta = shuttle.arrive_time + else + //otherwise we need to estimate the arrival time using the scheduled launch time + eta = launch_time + (shuttle.move_time * 10) + (shuttle.warmup_time * 10) + return (eta - world.time) / 10 + +//returns the time left until the shuttle launches, in seconds +/datum/controller/subsystem/emergency_shuttle/proc/estimate_launch_time() + return (launch_time - world.time) / 10 + +/datum/controller/subsystem/emergency_shuttle/proc/has_eta() + return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) + +//returns 1 if the shuttle has gone to the station and come back at least once, +//used for game completion checking purposes +/datum/controller/subsystem/emergency_shuttle/proc/returned() + return (departed && shuttle.moving_status == SHUTTLE_IDLE && shuttle.location) //we've gone to the station at least once, no longer in transit and are idle back at centcom + +//returns 1 if the shuttle is not idle at centcom +/datum/controller/subsystem/emergency_shuttle/proc/online() + if(!shuttle) + return FALSE + if(!shuttle.location) //not at centcom + return TRUE + if(wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) + return TRUE + return FALSE + +//returns 1 if the shuttle is currently in transit (or just leaving) to the station +/datum/controller/subsystem/emergency_shuttle/proc/going_to_station() + return shuttle && (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) + +//returns 1 if the shuttle is currently in transit (or just leaving) to centcom +/datum/controller/subsystem/emergency_shuttle/proc/going_to_centcom() + return shuttle && (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE) + +/datum/controller/subsystem/emergency_shuttle/proc/get_status_panel_eta() + if(online()) + if(shuttle.has_arrive_time()) + var/timeleft = SSemergency_shuttle.estimate_arrival_time() + return "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]" + + if(waiting_to_leave()) + if(shuttle.moving_status == SHUTTLE_WARMUP) + return "Departing..." + + var/timeleft = SSemergency_shuttle.estimate_launch_time() + return "ETD-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]" + + return "" diff --git a/code/controllers/subsystems/statpanel.dm b/code/controllers/subsystems/statpanel.dm index 86e4659e254..31cb9b87c61 100644 --- a/code/controllers/subsystems/statpanel.dm +++ b/code/controllers/subsystems/statpanel.dm @@ -36,8 +36,8 @@ SUBSYSTEM_DEF(statpanels) "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)" ) - if(GLOB.emergency_shuttle.evac) - var/ETA = GLOB.emergency_shuttle.get_status_panel_eta() + if(SSemergency_shuttle.evac) + var/ETA = SSemergency_shuttle.get_status_panel_eta() if(ETA) global_data += "[ETA]" diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index 5c4ac035634..81438dc9215 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -158,10 +158,10 @@ SUBSYSTEM_DEF(ticker) var/game_finished = FALSE var/mode_finished = FALSE if (CONFIG_GET(flag/continuous_rounds)) // Game keeps going after mode ends. - game_finished = (GLOB.emergency_shuttle.returned() || mode.station_was_nuked) + game_finished = (SSemergency_shuttle.returned() || mode.station_was_nuked) mode_finished = ((end_game_state >= END_GAME_MODE_FINISHED) || mode.check_finished()) // Short circuit if already finished. else // Game ends when mode does - game_finished = (mode.check_finished() || (GLOB.emergency_shuttle.returned() && GLOB.emergency_shuttle.evac == 1)) || GLOB.universe_has_ended + game_finished = (mode.check_finished() || (SSemergency_shuttle.returned() && SSemergency_shuttle.evac)) || GLOB.universe_has_ended mode_finished = game_finished if(game_finished && mode_finished) diff --git a/code/game/gamemodes/cult/narsie.dm b/code/game/gamemodes/cult/narsie.dm index a1d092f8ac3..2472093f37b 100644 --- a/code/game/gamemodes/cult/narsie.dm +++ b/code/game/gamemodes/cult/narsie.dm @@ -53,9 +53,9 @@ GLOBAL_VAR_INIT(narsie_cometh, 0) GLOB.narsie_cometh = 1 spawn(10 SECONDS) - if(GLOB.emergency_shuttle) - GLOB.emergency_shuttle.call_evac() - GLOB.emergency_shuttle.launch_time = 0 // Cannot recall + if(SSemergency_shuttle) + SSemergency_shuttle.call_evac() + SSemergency_shuttle.launch_time = 0 // Cannot recall /obj/singularity/narsie/process() eat() diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 8332c306bf1..685912d8121 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -203,9 +203,9 @@ GLOBAL_LIST_EMPTY(sacrificed) GLOB.narsie_cometh = 1 spawn(10 SECONDS) - if(GLOB.emergency_shuttle) - GLOB.emergency_shuttle.call_evac() - GLOB.emergency_shuttle.launch_time = 0 // Cannot recall + if(SSemergency_shuttle) + SSemergency_shuttle.call_evac() + SSemergency_shuttle.launch_time = 0 // Cannot recall log_and_message_admins_many(cultists, "summoned the end of days.") return diff --git a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm index bcaffc2c324..36e7b3f898f 100644 --- a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm +++ b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm @@ -44,9 +44,9 @@ GLOBAL_VAR_INIT(universe_has_ended, 0) for(var/mob/M in GLOB.player_list) M.flash_eyes() - if(GLOB.emergency_shuttle.can_recall()) + if(SSemergency_shuttle.can_recall()) GLOB.priority_announcement.Announce("The emergency shuttle has returned due to bluespace distortion.") - GLOB.emergency_shuttle.recall() + SSemergency_shuttle.recall() AreaSet() MiscSet() diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 4ae2c707d57..1659ae76a06 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -209,8 +209,8 @@ GLOBAL_LIST_EMPTY(additional_antag_types) if(antag.is_latejoin_template()) latejoin_templates |= antag - if(GLOB.emergency_shuttle && auto_recall_shuttle) - GLOB.emergency_shuttle.auto_recall = 1 + if(SSemergency_shuttle && auto_recall_shuttle) + SSemergency_shuttle.auto_recall = TRUE feedback_set_details("round_start","[time2text(world.realtime)]") INVOKE_ASYNC(SSdbcore, TYPE_PROC_REF(/datum/controller/subsystem/dbcore, SetRoundStart)) @@ -262,14 +262,14 @@ GLOBAL_LIST_EMPTY(additional_antag_types) GLOB.command_announcement.Announce("The presence of [pick(reasons)] in the region is tying up all available local emergency resources; emergency response teams cannot be called at this time, and post-evacuation recovery efforts will be substantially delayed.","Emergency Transmission") /datum/game_mode/proc/check_finished() - if(GLOB.emergency_shuttle.returned() || station_was_nuked) + if(SSemergency_shuttle.returned() || station_was_nuked) return 1 if(end_on_antag_death && antag_templates && antag_templates.len) for(var/datum/antagonist/antag in antag_templates) if(!antag.antags_are_dead()) return 0 if(CONFIG_GET(flag/continuous_rounds)) - GLOB.emergency_shuttle.auto_recall = 0 + SSemergency_shuttle.auto_recall = FALSE return 0 return 1 return 0 @@ -339,7 +339,7 @@ GLOBAL_LIST_EMPTY(additional_antag_types) var/text = "" if(surviving_total > 0) text += "
There [surviving_total>1 ? ("were " + span_bold("[surviving_total] survivors")) : ("was " + span_bold("one survivor"))] (" - text += span_bold("[escaped_total>0 ? escaped_total : "none"] [GLOB.emergency_shuttle.evac ? "escaped" : "transferred"]") + ") and " + span_bold("[ghosts] ghosts") + text += span_bold("[escaped_total>0 ? escaped_total : "none"] [SSemergency_shuttle.evac ? "escaped" : "transferred"]") + ") and " + span_bold("[ghosts] ghosts") text += ".
" else text += "There were " + span_bold("no survivors") + " (" + span_bold("[ghosts] ghosts") + ")." diff --git a/code/game/gamemodes/game_mode_latespawn.dm b/code/game/gamemodes/game_mode_latespawn.dm index d1378086b9a..9b29150cd71 100644 --- a/code/game/gamemodes/game_mode_latespawn.dm +++ b/code/game/gamemodes/game_mode_latespawn.dm @@ -28,10 +28,10 @@ /datum/game_mode/proc/try_latespawn(var/datum/mind/player, var/latejoin_only) - if(GLOB.emergency_shuttle.departed || !round_autoantag) + if(SSemergency_shuttle.departed || !round_autoantag) return - if(GLOB.emergency_shuttle.shuttle && (GLOB.emergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP || GLOB.emergency_shuttle.shuttle.moving_status == SHUTTLE_INTRANSIT)) + if(SSemergency_shuttle.shuttle && (SSemergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP || SSemergency_shuttle.shuttle.moving_status == SHUTTLE_INTRANSIT)) return // Don't do anything if the shuttle's coming. var/mills = round_duration_in_ds diff --git a/code/game/gamemodes/newobjective.dm b/code/game/gamemodes/newobjective.dm index 2971040e6e7..3122530acef 100644 --- a/code/game/gamemodes/newobjective.dm +++ b/code/game/gamemodes/newobjective.dm @@ -267,7 +267,7 @@ datum explanation_text = "Frame [target.current.real_name], the [target.assigned_role] for a crime and make sure they are arrested and brought back to the CentCom station alive. We'll handle the rest from there." check_completion() - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 if(target.current.stat == 2) return 0 @@ -313,7 +313,7 @@ datum explanation_text = "[target.current.real_name], the [target.assigned_role] is a [pick("relative of a","friend of a","") + pick("high ranking","important","well-liked")] mercenary [pick("Leader","Officer","Agent","sympathiser")]. Make sure they get off the station safely, while minimizing intervention." check_completion() - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 if(target.current.stat == 2) @@ -477,7 +477,7 @@ datum explanation_text = "Hijack the emergency shuttle by escaping alone." check_completion() - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 if(!owner.current || owner.current.stat == 2) @@ -512,7 +512,7 @@ datum explanation_text = "Escape on the shuttle alive, without being arrested." check_completion() - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 if(!owner.current || owner.current.stat ==2) @@ -1230,7 +1230,7 @@ datum check_completion() if(!istype(owner.current, /mob/living/silicon)) return 0 - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 if(!owner.current) return 0 @@ -1457,7 +1457,7 @@ datum explanation_text = "Do not allow anyone to escape the station. Only allow the shuttle to be called when everyone is dead and your story is the only one left." check_completion() - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 var/area/shuttle = locate(/area/shuttle/escape/centcom) diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 8791115b349..a33e22af9b1 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -41,7 +41,7 @@ GLOBAL_LIST_EMPTY(nuke_disks) if(!is_type_in_list(disk_area, GLOB.centcom_areas)) disk_rescued = 0 break - var/crew_evacuated = (GLOB.emergency_shuttle.returned()) + var/crew_evacuated = (SSemergency_shuttle.returned()) if(!disk_rescued && station_was_nuked && !syndies_didnt_escape) feedback_set_details("round_end_result","win - syndicate nuke") diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index 7d2f504a227..d6dd3ef1d24 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -219,7 +219,7 @@ GLOBAL_LIST_EMPTY(all_objectives) /datum/objective/hijack/check_completion() if(!owner.current || owner.current.stat) return 0 - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 if(issilicon(owner.current)) return 0 @@ -241,7 +241,7 @@ GLOBAL_LIST_EMPTY(all_objectives) /datum/objective/block/check_completion() if(!istype(owner.current, /mob/living/silicon)) return 0 - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 if(!owner.current) return 0 @@ -259,7 +259,7 @@ GLOBAL_LIST_EMPTY(all_objectives) explanation_text = "Do not allow anyone to escape the station. Only allow the shuttle to be called when everyone is dead and your story is the only one left." /datum/objective/silence/check_completion() - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 for(var/mob/living/player in GLOB.player_list) @@ -284,7 +284,7 @@ GLOBAL_LIST_EMPTY(all_objectives) return 0 if(isbrain(owner.current)) return 0 - if(!GLOB.emergency_shuttle.returned()) + if(!SSemergency_shuttle.returned()) return 0 if(!owner.current || owner.current.stat ==2) return 0 diff --git a/code/game/gamemodes/sandbox/sandbox.dm b/code/game/gamemodes/sandbox/sandbox.dm index 505bd22ea1f..7b0232016b5 100644 --- a/code/game/gamemodes/sandbox/sandbox.dm +++ b/code/game/gamemodes/sandbox/sandbox.dm @@ -14,4 +14,4 @@ /datum/game_mode/sandbox/post_setup() ..() if(emergency_shuttle) - GLOB.emergency_shuttle.auto_recall = 1 + SSemergency_shuttle.auto_recall = TRUE diff --git a/code/game/machinery/computer/shuttle.dm b/code/game/machinery/computer/shuttle.dm index 4b240d76fa7..c50f7d1d6f9 100644 --- a/code/game/machinery/computer/shuttle.dm +++ b/code/game/machinery/computer/shuttle.dm @@ -10,7 +10,7 @@ /obj/machinery/computer/shuttle/attackby(var/obj/item/card/W as obj, var/mob/user as mob) if(stat & (BROKEN|NOPOWER)) return - if ((!( istype(W, /obj/item/card) ) || !( SSticker ) || GLOB.emergency_shuttle.location() || !( user ))) return + if ((!( istype(W, /obj/item/card) ) || !( SSticker ) || SSemergency_shuttle.location() || !( user ))) return if (istype(W, /obj/item/card/id)||istype(W, /obj/item/pda)) if (istype(W, /obj/item/pda)) var/obj/item/pda/pda = W @@ -29,7 +29,7 @@ return 0 var/choice = tgui_alert(user, text("Would you like to (un)authorize a shortened launch time? [] authorization\s are still needed. Use abort to cancel all authorizations.", src.auth_need - src.authorized.len), "Shuttle Launch", list("Authorize", "Repeal", "Abort")) - if(GLOB.emergency_shuttle.location() && user.get_active_hand() != W) + if(SSemergency_shuttle.location() && user.get_active_hand() != W) return 0 switch(choice) if("Authorize") @@ -43,7 +43,7 @@ message_admins("[key_name_admin(user)] has launched the shuttle") log_game("[user.ckey] has launched the shuttle early") to_chat(world, span_boldnotice("Alert: Shuttle launch time shortened to 10 seconds!")) - GLOB.emergency_shuttle.set_launch_countdown(10) + SSemergency_shuttle.set_launch_countdown(10) //src.authorized = null qdel(src.authorized) src.authorized = list( ) @@ -60,11 +60,11 @@ else if (istype(W, /obj/item/card/emag) && !emagged) var/choice = tgui_alert(user, "Would you like to launch the shuttle?", "Shuttle control", list("Launch", "Cancel")) - if(!emagged && !GLOB.emergency_shuttle.location() && user.get_active_hand() == W) + if(!emagged && !SSemergency_shuttle.location() && user.get_active_hand() == W) switch(choice) if("Launch") to_chat(world, span_boldnotice("Alert: Shuttle launch time shortened to 10 seconds!")) - GLOB.emergency_shuttle.set_launch_countdown(10) + SSemergency_shuttle.set_launch_countdown(10) emagged = 1 if("Cancel") return diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 073cf9f30f2..a77dd209b7c 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -96,20 +96,20 @@ if(STATUS_DISPLAY_BLANK) //blank return 1 if(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME) //emergency shuttle timer - if(!GLOB.emergency_shuttle) + if(!SSemergency_shuttle) message1 = "-ETA-" message2 = "Never" // You're here forever. return 1 - if(GLOB.emergency_shuttle.waiting_to_leave()) + if(SSemergency_shuttle.waiting_to_leave()) message1 = "-ETD-" - if(GLOB.emergency_shuttle.shuttle.is_launching()) + if(SSemergency_shuttle.shuttle.is_launching()) message2 = "Launch" else message2 = get_shuttle_timer_departure() if(length(message2) > CHARS_PER_LINE) message2 = "Error" update_display(message1, message2) - else if(GLOB.emergency_shuttle.has_eta()) + else if(SSemergency_shuttle.has_eta()) message1 = "-ETA-" message2 = get_shuttle_timer_arrival() if(length(message2) > CHARS_PER_LINE) @@ -208,17 +208,17 @@ maptext = new_text /obj/machinery/status_display/proc/get_shuttle_timer_arrival() - if(!GLOB.emergency_shuttle) + if(!SSemergency_shuttle) return "Error" - var/timeleft = GLOB.emergency_shuttle.estimate_arrival_time() + var/timeleft = SSemergency_shuttle.estimate_arrival_time() if(timeleft < 0) return "" return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" /obj/machinery/status_display/proc/get_shuttle_timer_departure() - if(!GLOB.emergency_shuttle) + if(!SSemergency_shuttle) return "Error" - var/timeleft = GLOB.emergency_shuttle.estimate_launch_time() + var/timeleft = SSemergency_shuttle.estimate_launch_time() if(timeleft < 0) return "" return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]" diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 02f0c76d183..1a5cca580ec 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -395,19 +395,19 @@ dat += "Current Game Mode: " + span_bold("[SSticker.mode.name]") + "
" dat += "Round Duration: " + span_bold("[roundduration2text()]") + "
" dat += span_bold("Emergency shuttle") + "
" - if (!GLOB.emergency_shuttle.online()) + if (!SSemergency_shuttle.online()) dat += "Call Shuttle
" else - if (GLOB.emergency_shuttle.wait_for_launch) - var/timeleft = GLOB.emergency_shuttle.estimate_launch_time() + if (SSemergency_shuttle.wait_for_launch) + var/timeleft = SSemergency_shuttle.estimate_launch_time() dat += "ETL: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" - else if (GLOB.emergency_shuttle.shuttle.has_arrive_time()) - var/timeleft = GLOB.emergency_shuttle.estimate_arrival_time() + else if (SSemergency_shuttle.shuttle.has_arrive_time()) + var/timeleft = SSemergency_shuttle.estimate_arrival_time() dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" dat += "Send Back
" - if (GLOB.emergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP) + if (SSemergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP) dat += "Launching now..." dat += "[SSticker.delay_end ? "End Round Normally" : "Delay Round End"]
" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index ba715a2ccac..e0d73e99cb4 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -83,23 +83,23 @@ switch(href_list["call_shuttle"]) if("1") - if ((!( SSticker ) || !GLOB.emergency_shuttle.location())) + if ((!( SSticker ) || !SSemergency_shuttle.location())) return - if (GLOB.emergency_shuttle.can_call()) - GLOB.emergency_shuttle.call_evac() + if (SSemergency_shuttle.can_call()) + SSemergency_shuttle.call_evac() log_admin("[key_name(usr)] called the Emergency Shuttle") message_admins(span_blue("[key_name_admin(usr)] called the Emergency Shuttle to the station."), 1) if("2") - if (!( SSticker ) || !GLOB.emergency_shuttle.location()) + if (!( SSticker ) || !SSemergency_shuttle.location()) return - if (GLOB.emergency_shuttle.can_call()) - GLOB.emergency_shuttle.call_evac() + if (SSemergency_shuttle.can_call()) + SSemergency_shuttle.call_evac() log_admin("[key_name(usr)] called the Emergency Shuttle") message_admins(span_blue("[key_name_admin(usr)] called the Emergency Shuttle to the station."), 1) - else if (GLOB.emergency_shuttle.can_recall()) - GLOB.emergency_shuttle.recall() + else if (SSemergency_shuttle.can_recall()) + SSemergency_shuttle.recall() log_admin("[key_name(usr)] sent the Emergency Shuttle back") message_admins(span_blue("[key_name_admin(usr)] sent the Emergency Shuttle back."), 1) @@ -108,20 +108,20 @@ else if(href_list["edit_shuttle_time"]) if(!check_rights(R_SERVER)) return - if (GLOB.emergency_shuttle.wait_for_launch) - var/new_time_left = tgui_input_number(usr, "Enter new shuttle launch countdown (seconds):","Edit Shuttle Launch Time", GLOB.emergency_shuttle.estimate_launch_time() ) + if (SSemergency_shuttle.wait_for_launch) + var/new_time_left = tgui_input_number(usr, "Enter new shuttle launch countdown (seconds):","Edit Shuttle Launch Time", SSemergency_shuttle.estimate_launch_time() ) - GLOB.emergency_shuttle.launch_time = world.time + new_time_left*10 + SSemergency_shuttle.launch_time = world.time + (new_time_left * 10) log_admin("[key_name(usr)] edited the Emergency Shuttle's launch time to [new_time_left]") - message_admins(span_blue("[key_name_admin(usr)] edited the Emergency Shuttle's launch time to [new_time_left*10]"), 1) - else if (GLOB.emergency_shuttle.shuttle.has_arrive_time()) + message_admins(span_blue("[key_name_admin(usr)] edited the Emergency Shuttle's launch time to [new_time_left * 10]"), 1) + else if (SSemergency_shuttle.shuttle.has_arrive_time()) - var/new_time_left = tgui_input_number(usr, "Enter new shuttle arrival time (seconds):","Edit Shuttle Arrival Time", GLOB.emergency_shuttle.estimate_arrival_time() ) - GLOB.emergency_shuttle.shuttle.arrive_time = world.time + new_time_left*10 + var/new_time_left = tgui_input_number(usr, "Enter new shuttle arrival time (seconds):","Edit Shuttle Arrival Time", SSemergency_shuttle.estimate_arrival_time() ) + SSemergency_shuttle.shuttle.arrive_time = world.time + (new_time_left * 10) log_admin("[key_name(usr)] edited the Emergency Shuttle's arrival time to [new_time_left]") - message_admins(span_blue("[key_name_admin(usr)] edited the Emergency Shuttle's arrival time to [new_time_left*10]"), 1) + message_admins(span_blue("[key_name_admin(usr)] edited the Emergency Shuttle's arrival time to [new_time_left * 10]"), 1) else tgui_alert_async(usr, "The shuttle is neither counting down to launch nor is it in transit. Please try again when it is.") diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 1538a7b0f4f..46e37b362df 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -677,7 +677,7 @@ ADMIN_VERB(toggle_view_range, R_HOLDER, "Change View Range", "Switches between 1 feedback_add_details("admin_verb","CVRA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! ADMIN_VERB(admin_call_shuttle, R_ADMIN|R_SERVER, "Call Shuttle", "Calls the emergency shuttel.", ADMIN_CATEGORY_EVENTS) - if ((!( SSticker ) || !GLOB.emergency_shuttle.location())) + if ((!( SSticker ) || !SSemergency_shuttle.location())) return var/confirm = tgui_alert(user, "You sure?", "Confirm", list("Yes", "No")) @@ -687,15 +687,15 @@ ADMIN_VERB(admin_call_shuttle, R_ADMIN|R_SERVER, "Call Shuttle", "Calls the emer if(SSticker.mode.auto_recall_shuttle) choice = tgui_input_list(user, "The shuttle will just return if you call it. Call anyway?", "Shuttle Call", list("Confirm", "Cancel")) if(choice == "Confirm") - GLOB.emergency_shuttle.auto_recall = 1 //enable auto-recall + SSemergency_shuttle.auto_recall = TRUE //enable auto-recall else return choice = tgui_input_list(user, "Is this an emergency evacuation or a crew transfer?", "Shuttle Call", list("Emergency", "Crew Transfer")) if (choice == "Emergency") - GLOB.emergency_shuttle.call_evac() + SSemergency_shuttle.call_evac() else - GLOB.emergency_shuttle.call_transfer() + SSemergency_shuttle.call_transfer() feedback_add_details("admin_verb","CSHUT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -705,10 +705,10 @@ ADMIN_VERB(admin_call_shuttle, R_ADMIN|R_SERVER, "Call Shuttle", "Calls the emer ADMIN_VERB(admin_cancel_shuttle, R_ADMIN|R_FUN, "Cancel Shuttle", "Cancels the emergency shuttel.", ADMIN_CATEGORY_EVENTS) if(tgui_alert(user, "You sure?", "Confirm", list("Yes", "No")) != "Yes") return - if(!SSticker || !GLOB.emergency_shuttle.can_recall()) + if(!SSticker || !SSemergency_shuttle.can_recall()) return - GLOB.emergency_shuttle.recall() + SSemergency_shuttle.recall() feedback_add_details("admin_verb","CCSHUT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_admin("[key_name(user)] admin-recalled the emergency shuttle.") message_admins(span_blue("[key_name_admin(user)] admin-recalled the emergency shuttle.")) @@ -717,10 +717,10 @@ ADMIN_VERB(admin_deny_shuttle, R_ADMIN, "Toggle Deny Shuttle", "Prevents the shu if (!SSticker) return - GLOB.emergency_shuttle.deny_shuttle = !GLOB.emergency_shuttle.deny_shuttle + SSemergency_shuttle.deny_shuttle = !SSemergency_shuttle.deny_shuttle - log_admin("[key_name(user)] has [GLOB.emergency_shuttle.deny_shuttle ? "denied" : "allowed"] the shuttle to be called.") - message_admins("[key_name_admin(user)] has [GLOB.emergency_shuttle.deny_shuttle ? "denied" : "allowed"] the shuttle to be called.") + log_admin("[key_name(user)] has [SSemergency_shuttle.deny_shuttle ? "denied" : "allowed"] the shuttle to be called.") + message_admins("[key_name_admin(user)] has [SSemergency_shuttle.deny_shuttle ? "denied" : "allowed"] the shuttle to be called.") ADMIN_VERB(everyone_random, R_FUN, "Make Everyone Random", "Make everyone have a random appearance. You can only use this before rounds!", ADMIN_CATEGORY_FUN_DO_NOT) if (SSticker && SSticker.mode) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 8de0b393d1b..29039455bba 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -245,8 +245,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/observer/dead/get_status_tab_items() . = ..() - if(GLOB.emergency_shuttle) - var/eta_status = GLOB.emergency_shuttle.get_status_panel_eta() + if(SSemergency_shuttle) + var/eta_status = SSemergency_shuttle.get_status_panel_eta() if(eta_status) . += "" . += "[eta_status]" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 79cfba81bf5..045ac981dd8 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -100,8 +100,8 @@ . += "" . += "Intent: [a_intent]" . += "Move Mode: [m_intent]" - if(GLOB.emergency_shuttle) - var/eta_status = GLOB.emergency_shuttle.get_status_panel_eta() + if(SSemergency_shuttle) + var/eta_status = SSemergency_shuttle.get_status_panel_eta() if(eta_status) . += "[eta_status]" diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index e46acaffddd..e0d436788a1 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -407,7 +407,7 @@ GLOBAL_LIST_INIT(ai_verbs_default, list( call_shuttle_proc(src) // hack to display shuttle timer - if(GLOB.emergency_shuttle.online()) + if(SSemergency_shuttle.online()) post_status(src, "shuttle", user = src) /mob/living/silicon/ai/proc/ai_recall_shuttle() diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index f15d936a498..205db501d4b 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -157,8 +157,8 @@ // this function displays the shuttles ETA in the status panel if the shuttle has been called /mob/living/silicon/proc/show_emergency_shuttle_eta() - if(GLOB.emergency_shuttle) - var/eta_status = GLOB.emergency_shuttle.get_status_panel_eta() + if(SSemergency_shuttle) + var/eta_status = SSemergency_shuttle.get_status_panel_eta() if(eta_status) . = "[eta_status]" diff --git a/code/modules/shuttles/escape_pods.dm b/code/modules/shuttles/escape_pods.dm index 9415897801a..37144bf7372 100644 --- a/code/modules/shuttles/escape_pods.dm +++ b/code/modules/shuttles/escape_pods.dm @@ -4,9 +4,9 @@ /datum/shuttle/autodock/ferry/escape_pod/New() move_time = move_time + rand(-30, 60) - if(name in GLOB.emergency_shuttle.escape_pods) + if(name in SSemergency_shuttle.escape_pods) CRASH("An escape pod with the name '[name]' has already been defined.") - GLOB.emergency_shuttle.escape_pods[name] = src + SSemergency_shuttle.escape_pods[name] = src ..() @@ -56,7 +56,7 @@ "docking_status" = docking_program.get_docking_status(), "override_enabled" = docking_program.override_enabled, "exterior_status" = docking_program.memory["door_status"], // TGUI DATA fails silently when there's no linked pod, leading to UI crashes - "can_force" = pod?.can_force() || (GLOB.emergency_shuttle.departed && pod?.can_launch()), //allow players to manually launch ahead of time if the shuttle leaves + "can_force" = pod?.can_force() || (SSemergency_shuttle.departed && pod?.can_launch()), //allow players to manually launch ahead of time if the shuttle leaves "armed" = pod?.arming_controller.armed, "internalTemplateName" = "EscapePodConsole", ) @@ -72,7 +72,7 @@ if("force_launch") if(pod.can_force()) pod.force_launch(src) - else if(GLOB.emergency_shuttle.departed && pod.can_launch()) //allow players to manually launch ahead of time if the shuttle leaves + else if(SSemergency_shuttle.departed && pod.can_launch()) //allow players to manually launch ahead of time if the shuttle leaves pod.launch(src) . = TRUE diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index 17d30a4925b..2fb86dd82e2 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -7,9 +7,9 @@ /datum/shuttle/autodock/ferry/emergency/New() ..() radio_connection = SSradio.add_object(src, frequency, null) - if(GLOB.emergency_shuttle.shuttle) + if(SSemergency_shuttle.shuttle) CRASH("An emergency shuttle has already been defined.") - GLOB.emergency_shuttle.shuttle = src + SSemergency_shuttle.shuttle = src /datum/shuttle/autodock/ferry/emergency/arrived() . = ..() @@ -17,7 +17,7 @@ var/obj/machinery/computer/shuttle_control/emergency/C = in_use C.reset_authorization() - GLOB.emergency_shuttle.shuttle_arrived() + SSemergency_shuttle.shuttle_arrived() /datum/shuttle/autodock/ferry/emergency/long_jump(var/destination, var/interim, var/travel_time) if (!location) @@ -27,17 +27,17 @@ //update move_time and launch_time so we get correct ETAs move_time = travel_time - GLOB.emergency_shuttle.launch_time = world.time + SSemergency_shuttle.launch_time = world.time ..(destination, interim, travel_time, direction) /datum/shuttle/autodock/ferry/emergency/perform_shuttle_move() if (current_location == landmark_station) //leaving the station spawn(0) - GLOB.emergency_shuttle.departed = 1 - var/estimated_time = round(GLOB.emergency_shuttle.estimate_arrival_time()/60,1) + SSemergency_shuttle.departed = TRUE + var/estimated_time = round(SSemergency_shuttle.estimate_arrival_time()/60,1) - if (GLOB.emergency_shuttle.evac) + if (SSemergency_shuttle.evac) GLOB.priority_announcement.Announce(replacetext(replacetext(using_map.emergency_shuttle_leaving_dock, "%dock_name%", "[using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s")) else GLOB.priority_announcement.Announce(replacetext(replacetext(using_map.shuttle_leaving_dock, "%dock_name%", "[using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s"), "Transfer System", 'sound/AI/tramdepart.ogg') @@ -71,8 +71,8 @@ if (!can_launch(user)) return if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console - if (GLOB.emergency_shuttle.autopilot) - GLOB.emergency_shuttle.autopilot = 0 + if (SSemergency_shuttle.autopilot) + SSemergency_shuttle.autopilot = FALSE to_chat(world, span_boldnotice("Alert: The shuttle autopilot has been overridden. Launch sequence initiated!")) if(usr) @@ -85,8 +85,8 @@ if (!can_force(user)) return if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console - if (GLOB.emergency_shuttle.autopilot) - GLOB.emergency_shuttle.autopilot = 0 + if (SSemergency_shuttle.autopilot) + SSemergency_shuttle.autopilot = FALSE to_chat(world, span_boldnotice("Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!")) if(usr) @@ -99,8 +99,8 @@ if (!can_cancel(user)) return if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console - if (GLOB.emergency_shuttle.autopilot) - GLOB.emergency_shuttle.autopilot = 0 + if (SSemergency_shuttle.autopilot) + SSemergency_shuttle.autopilot = FALSE to_chat(world, span_boldnotice("Alert: The shuttle autopilot has been overridden. Launch sequence aborted!")) if(usr) diff --git a/code/modules/tgui/modules/communications.dm b/code/modules/tgui/modules/communications.dm index 1ffbcea1d42..0680b9f2248 100644 --- a/code/modules/tgui/modules/communications.dm +++ b/code/modules/tgui/modules/communications.dm @@ -25,6 +25,8 @@ var/message_cooldown var/centcomm_message_cooldown + ///Cooldown on how quickly you can change the station's level. + COOLDOWN_DECLARE(level_change_cooldown) var/tmp_alertlevel = 0 var/stat_msg1 @@ -63,6 +65,10 @@ return COMM_AUTHENTICATION_NONE /datum/tgui_module/communications/proc/change_security_level(mob/user, new_level) + if(!COOLDOWN_FINISHED(src, level_change_cooldown)) + to_chat(user, span_warning("Please wait [round((COOLDOWN_TIMELEFT(src, level_change_cooldown) * 0.1), 1)] second(s) before changing the station's alert level again.")) + tmp_alertlevel = 0 + return tmp_alertlevel = new_level var/old_level = GLOB.security_level if(!tmp_alertlevel) tmp_alertlevel = SEC_LEVEL_GREEN @@ -84,6 +90,7 @@ feedback_inc("alert_comms_orange",1) if(SEC_LEVEL_BLUE) feedback_inc("alert_comms_blue",1) + COOLDOWN_START(src, level_change_cooldown, 2 MINUTES) // 2 minute cd on station alert changing. tmp_alertlevel = 0 /datum/tgui_module/communications/tgui_data(mob/user) @@ -145,12 +152,12 @@ data["msg_cooldown"] = message_cooldown ? (round((message_cooldown - world.time) / 10)) : 0 data["cc_cooldown"] = centcomm_message_cooldown ? (round((centcomm_message_cooldown - world.time) / 10)) : 0 - data["esc_callable"] = GLOB.emergency_shuttle.location() && !GLOB.emergency_shuttle.online() ? TRUE : FALSE - data["esc_recallable"] = GLOB.emergency_shuttle.location() && GLOB.emergency_shuttle.online() ? TRUE : FALSE + data["esc_callable"] = SSemergency_shuttle.location() && !SSemergency_shuttle.online() ? TRUE : FALSE + data["esc_recallable"] = SSemergency_shuttle.location() && SSemergency_shuttle.online() ? TRUE : FALSE data["esc_status"] = FALSE - if(GLOB.emergency_shuttle.has_eta()) - var/timeleft = GLOB.emergency_shuttle.estimate_arrival_time() - data["esc_status"] = GLOB.emergency_shuttle.online() ? "ETA:" : "RECALLING:" + if(SSemergency_shuttle.has_eta()) + var/timeleft = SSemergency_shuttle.estimate_arrival_time() + data["esc_status"] = SSemergency_shuttle.online() ? "ETA:" : "RECALLING:" data["esc_status"] += " [timeleft / 60 % 60]:[add_zero(num2text(timeleft % 60), 2)]" return data @@ -272,7 +279,7 @@ return call_shuttle_proc(ui.user) - if(GLOB.emergency_shuttle.online()) + if(SSemergency_shuttle.online()) post_status(src, "shuttle", user = ui.user) setMenuState(ui.user, COMM_SCREEN_MAIN) @@ -381,7 +388,7 @@ PS.allowedtocall = !(PS.allowedtocall) /proc/call_shuttle_proc(var/mob/user) - if ((!( SSticker ) || !GLOB.emergency_shuttle.location())) + if ((!( SSticker ) || !SSemergency_shuttle.location())) return if(!GLOB.universe.OnShuttleCall(user)) @@ -392,7 +399,7 @@ to_chat(user, "[using_map.boss_short] will not allow the shuttle to be called. Consider all contracts terminated.") return - if(GLOB.emergency_shuttle.deny_shuttle) + if(SSemergency_shuttle.deny_shuttle) to_chat(user, "The emergency shuttle may not be sent at this time. Please try again later.") return @@ -400,11 +407,11 @@ to_chat(user, "The emergency shuttle is refueling. Please wait another [round((6000-world.time)/600)] minute\s before trying again.") return - if(GLOB.emergency_shuttle.going_to_centcom()) + if(SSemergency_shuttle.going_to_centcom()) to_chat(user, "The emergency shuttle may not be called while returning to [using_map.boss_short].") return - if(GLOB.emergency_shuttle.online()) + if(SSemergency_shuttle.online()) to_chat(user, "The emergency shuttle is already on its way.") return @@ -412,7 +419,7 @@ to_chat(user, "Under directive 7-10, [station_name()] is quarantined until further notice.") return - GLOB.emergency_shuttle.call_evac() + SSemergency_shuttle.call_evac() log_game("[key_name(user)] has called the shuttle.") message_admins("[key_name_admin(user)] has called the shuttle.", 1) admin_chat_message(message = "Emergency evac beginning! Called by [key_name(user)]!", color = "#CC2222") //VOREStation Add @@ -420,20 +427,20 @@ return /proc/init_shift_change(var/mob/user, var/force = 0) - if ((!( SSticker ) || !GLOB.emergency_shuttle.location())) + if ((!( SSticker ) || !SSemergency_shuttle.location())) return - if(GLOB.emergency_shuttle.going_to_centcom()) + if(SSemergency_shuttle.going_to_centcom()) to_chat(user, "The shuttle may not be called while returning to [using_map.boss_short].") return - if(GLOB.emergency_shuttle.online()) + if(SSemergency_shuttle.online()) to_chat(user, "The shuttle is already on its way.") return // if force is 0, some things may stop the shuttle call if(!force) - if(GLOB.emergency_shuttle.deny_shuttle) + if(SSemergency_shuttle.deny_shuttle) to_chat(user, "[using_map.boss_short] does not currently have a shuttle available in your sector. Please try again later.") return @@ -447,13 +454,13 @@ if(SSticker.mode.auto_recall_shuttle) //New version pretends to call the shuttle but cause the shuttle to return after a random duration. - GLOB.emergency_shuttle.auto_recall = 1 + SSemergency_shuttle.auto_recall = TRUE if(SSticker.mode.name == "blob" || SSticker.mode.name == "epidemic") to_chat(user, "Under directive 7-10, [station_name()] is quarantined until further notice.") return - GLOB.emergency_shuttle.call_transfer() + SSemergency_shuttle.call_transfer() //delay events in case of an autotransfer if (isnull(user)) @@ -467,13 +474,13 @@ return /proc/cancel_call_proc(var/mob/user) - if (!( SSticker ) || !GLOB.emergency_shuttle.can_recall()) + if (!( SSticker ) || !SSemergency_shuttle.can_recall()) return if((SSticker.mode.name == "blob")||(SSticker.mode.name == "Meteor")) return - if(!GLOB.emergency_shuttle.going_to_centcom()) //check that shuttle isn't already heading to CentCom - GLOB.emergency_shuttle.recall() + if(!SSemergency_shuttle.going_to_centcom()) //check that shuttle isn't already heading to CentCom + SSemergency_shuttle.recall() log_game("[key_name(user)] has recalled the shuttle.") message_admins("[key_name_admin(user)] has recalled the shuttle.", 1) return diff --git a/code/modules/tgui/modules/late_choices.dm b/code/modules/tgui/modules/late_choices.dm index a3d2c8194a7..130cf1b9684 100644 --- a/code/modules/tgui/modules/late_choices.dm +++ b/code/modules/tgui/modules/late_choices.dm @@ -62,10 +62,10 @@ data["name"] = name data["duration"] = roundduration2text() - if(GLOB.emergency_shuttle?.going_to_centcom()) + if(SSemergency_shuttle?.going_to_centcom()) data["evac"] = "Gone" - else if(GLOB.emergency_shuttle?.online()) - if(GLOB.emergency_shuttle.evac) + else if(SSemergency_shuttle?.online()) + if(SSemergency_shuttle.evac) data["evac"] = "Emergency" else data["evac"] = "Crew Transfer" diff --git a/maps/common/common_things.dm b/maps/common/common_things.dm index 7e4b22bb4a7..572f943da1e 100644 --- a/maps/common/common_things.dm +++ b/maps/common/common_things.dm @@ -146,7 +146,7 @@ spawnpoint_type = /datum/spawnpoint/tram /obj/machinery/cryopod/robot/door/tram/process() - if(GLOB.emergency_shuttle.online() || GLOB.emergency_shuttle.returned()) + if(SSemergency_shuttle.online() || SSemergency_shuttle.returned()) // Transform into a door! But first despawn anyone inside time_till_despawn = 0 ..() diff --git a/vorestation.dme b/vorestation.dme index 0a3cdc8ee5c..b5cc0a9ff01 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -535,7 +535,6 @@ #include "code\ATMOSPHERICS\pipes\vent.dm" #include "code\controllers\admin.dm" #include "code\controllers\controller.dm" -#include "code\controllers\emergency_shuttle_controller.dm" #include "code\controllers\failsafe.dm" #include "code\controllers\globals.dm" #include "code\controllers\hooks-defs.dm" @@ -573,6 +572,7 @@ #include "code\controllers\subsystems\dbcore.dm" #include "code\controllers\subsystems\dcs.dm" #include "code\controllers\subsystems\early_assets.dm" +#include "code\controllers\subsystems\emergency_shuttle.dm" #include "code\controllers\subsystems\events.dm" #include "code\controllers\subsystems\explosions.dm" #include "code\controllers\subsystems\garbage.dm"