# Conflicts: # Content.Client/Administration/Managers/ClientAdminManager.cs # Content.Client/Administration/Systems/BwoinkSystem.cs # Content.Client/Alerts/ClientAlertsSystem.cs # Content.Client/Audio/BackgroundAudioSystem.cs # Content.Client/CardboardBox/CardboardBoxSystem.cs # Content.Client/Chemistry/UI/InjectorStatusControl.cs # Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml # Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml.cs # Content.Client/Clothing/ClientClothingSystem.cs # Content.Client/CriminalRecords/CriminalRecordsConsoleBoundUserInterface.cs # Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs # Content.Client/Decals/Overlays/DecalOverlay.cs # Content.Client/DoAfter/DoAfterOverlay.cs # Content.Client/Doors/AirlockSystem.cs # Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml # Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs # Content.Client/Launcher/LauncherConnectingGui.xaml # Content.Client/Launcher/LauncherConnectingGui.xaml.cs # Content.Client/Lobby/LobbyState.cs # Content.Client/Lobby/UI/LobbyGui.xaml.cs # Content.Client/MainMenu/UI/MainMenuControl.xaml # Content.Client/MassMedia/Ui/MiniArticleCardControl.xaml # Content.Client/MassMedia/Ui/MiniArticleCardControl.xaml.cs # Content.Client/MassMedia/Ui/NewsWriteMenu.xaml # Content.Client/MassMedia/Ui/NewsWriteMenu.xaml.cs # Content.Client/Options/UI/Tabs/MiscTab.xaml # Content.Client/Options/UI/Tabs/MiscTab.xaml.cs # Content.Client/Outline/InteractionOutlineSystem.cs # Content.Client/Overlays/ShowSecurityIconsSystem.cs # Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs # Content.Client/Popups/PopupOverlay.cs # Content.Client/Popups/PopupSystem.cs # Content.Client/Preferences/ClientPreferencesManager.cs # Content.Client/Preferences/UI/HumanoidProfileEditor.xaml # Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs # Content.Client/StatusIcon/StatusIconOverlay.cs # Content.Client/Stylesheets/StyleNano.cs # Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs # Content.Client/UserInterface/Systems/Chat/ChatUIController.cs # Content.Server/Access/Systems/IdCardConsoleSystem.cs # Content.Server/Administration/Commands/BanCommand.cs # Content.Server/Administration/Notes/AdminMessageEui.cs # Content.Server/Administration/Notes/AdminNotesSystem.cs # Content.Server/Administration/Notes/IAdminNotesManager.cs # Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs # Content.Server/Administration/Systems/BwoinkSystem.cs # Content.Server/Administration/UI/PermissionsEui.cs # Content.Server/Antag/AntagSelectionSystem.cs # Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs # Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs # Content.Server/Chat/Systems/ChatSystem.cs # Content.Server/Chemistry/EntitySystems/InjectorSystem.cs # Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs # Content.Server/Connection/ConnectionManager.cs # Content.Server/CriminalRecords/Systems/CriminalRecordsConsoleSystem.cs # Content.Server/Database/DatabaseRecords.cs # Content.Server/Database/ServerDbBase.cs # Content.Server/Database/ServerDbManager.cs # Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs # Content.Server/Doors/Systems/DoorSystem.cs # Content.Server/Execution/ExecutionSystem.cs # Content.Server/Explosion/EntitySystems/ExplosionSystem.cs # Content.Server/Fax/FaxSystem.cs # Content.Server/Fluids/EntitySystems/PuddleSystem.Evaporation.cs # Content.Server/GameTicking/GameTicker.Replays.cs # Content.Server/GameTicking/GameTicker.RoundFlow.cs # Content.Server/GameTicking/Rules/Components/ThiefRuleComponent.cs # Content.Server/GameTicking/Rules/GameRuleSystem.Utility.cs # Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs # Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs # Content.Server/GameTicking/Rules/ThiefRuleSystem.cs # Content.Server/GameTicking/Rules/TraitorRuleSystem.cs # Content.Server/GameTicking/Rules/ZombieRuleSystem.cs # Content.Server/Hands/Systems/HandsSystem.cs # Content.Server/Holosign/HolosignSystem.cs # Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs # Content.Server/Info/InfoSystem.cs # Content.Server/Kitchen/EntitySystems/SharpSystem.cs # Content.Server/Magic/MagicSystem.cs # Content.Server/MagicMirror/MagicMirrorSystem.cs # Content.Server/Mapping/MappingSystem.cs # Content.Server/MassMedia/Systems/NewsSystem.cs # Content.Server/Medical/Components/HealthAnalyzerComponent.cs # Content.Server/Medical/CrewMonitoring/CrewMonitoringServerSystem.cs # Content.Server/Medical/CryoPodSystem.cs # Content.Server/Medical/HealthAnalyzerSystem.cs # Content.Server/Nutrition/EntitySystems/OpenableSystem.cs # Content.Server/Preferences/Managers/ServerPreferencesManager.cs # Content.Server/Remotes/DoorRemoteSystem.cs # Content.Server/Resist/EscapeInventorySystem.cs # Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs # Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs # Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs # Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs # Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs # Content.Server/Species/Systems/NymphSystem.cs # Content.Server/StationEvents/Components/GasLeakRuleComponent.cs # Content.Server/StationEvents/EventManagerSystem.cs # Content.Server/Store/Systems/StoreSystem.Ui.cs # Content.Server/Strip/StrippableSystem.cs # Content.Server/VendingMachines/VendingMachineSystem.cs # Content.Server/Weapons/Ranged/Systems/GunSystem.cs # Content.Shared.Database/LogType.cs # Content.Shared/Actions/SharedActionsSystem.cs # Content.Shared/Administration/AdminFlags.cs # Content.Shared/Administration/SharedBwoinkSystem.cs # Content.Shared/Anomaly/SharedAnomalySystem.cs # Content.Shared/Bed/Sleep/SharedSleepingSystem.cs # Content.Shared/Buckle/SharedBuckleSystem.Strap.cs # Content.Shared/Chat/ChatChannel.cs # Content.Shared/Chemistry/Components/InjectorComponent.cs # Content.Shared/Chemistry/EntitySystems/SharedInjectorSystem.cs # Content.Shared/Chemistry/SharedReagentDispenser.cs # Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs # Content.Shared/CriminalRecords/Systems/SharedCriminalRecordsConsoleSystem.cs # Content.Shared/Cuffs/SharedCuffableSystem.cs # Content.Shared/Doors/Systems/SharedDoorSystem.cs # Content.Shared/Friction/TileFrictionController.cs # Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs # Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs # Content.Shared/Implants/SharedImplanterSystem.cs # Content.Shared/Lock/LockSystem.cs # Content.Shared/MedicalScanner/HealthAnalyzerScannedUserMessage.cs # Content.Shared/Nutrition/Components/OpenableComponent.cs # Content.Shared/Nutrition/EntitySystems/SharedOpenableSystem.cs # Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs # Content.Shared/Preferences/HumanoidCharacterProfile.cs # Content.Shared/Preferences/ICharacterProfile.cs # Content.Shared/Projectiles/SharedProjectileSystem.cs # Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs # Content.Shared/Security/SecurityStatus.cs # Content.Shared/Security/Systems/DeployableBarrierSystem.cs # Content.Shared/Slippery/SlipperySystem.cs # Content.Shared/Species/Systems/ReformSystem.cs # Content.Shared/Standing/StandingStateSystem.cs # Content.Shared/StatusIcon/StatusIconPrototype.cs # Content.Shared/Store/ListingPrototype.cs # Content.Shared/VendingMachines/SharedVendingMachineSystem.cs # Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs # README.md # Resources/Audio/Ambience/Antag/pirate_start.ogg # Resources/Changelog/Changelog.yml # Resources/Credits/GitHub.txt # Resources/Locale/en-US/criminal-records/criminal-records.ftl # Resources/Locale/en-US/escape-menu/ui/options-menu.ftl # Resources/Locale/en-US/medical/components/health-analyzer-component.ftl # Resources/Locale/en-US/reagents/meta/biological.ftl # Resources/Locale/en-US/reagents/meta/fun.ftl # Resources/Locale/en-US/reagents/meta/physical-desc.ftl # Resources/Locale/en-US/seeds/seeds.ftl # Resources/Locale/en-US/wires/wire-names.ftl # Resources/Maps/Shuttles/cargo_fland.yml # Resources/Maps/core.yml # Resources/Maps/europa.yml # Resources/Maps/fland.yml # Resources/Maps/origin.yml # Resources/Maps/saltern.yml # Resources/Maps/train.yml # Resources/Prototypes/Actions/diona.yml # Resources/Prototypes/Atmospherics/gases.yml # Resources/Prototypes/Catalog/Cargo/cargo_emergency.yml # Resources/Prototypes/Catalog/Cargo/cargo_engines.yml # Resources/Prototypes/Catalog/Cargo/cargo_fun.yml # Resources/Prototypes/Catalog/Cargo/cargo_security.yml # Resources/Prototypes/Catalog/Cargo/cargo_service.yml # Resources/Prototypes/Catalog/Cargo/cargo_vending.yml # Resources/Prototypes/Catalog/Fills/Boxes/general.yml # Resources/Prototypes/Catalog/Fills/Boxes/syndicate.yml # Resources/Prototypes/Catalog/Fills/Crates/engines.yml # Resources/Prototypes/Catalog/Fills/Items/briefcases.yml # Resources/Prototypes/Catalog/Fills/Items/toolboxes.yml # Resources/Prototypes/Catalog/Fills/Lockers/dressers.yml # Resources/Prototypes/Catalog/Fills/Lockers/heads.yml # Resources/Prototypes/Catalog/Fills/Lockers/security.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/bardrobe.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/clothesmate.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/lawdrobe.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/medical.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/medidrobe.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/robotics.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/sec.yml # Resources/Prototypes/Catalog/uplink_catalog.yml # Resources/Prototypes/Datasets/Names/first_male.yml # Resources/Prototypes/Datasets/tips.yml # Resources/Prototypes/Entities/Clothing/Hands/colored.yml # Resources/Prototypes/Entities/Clothing/Head/base_clothinghead.yml # Resources/Prototypes/Entities/Clothing/Head/hats.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/coats.yml # Resources/Prototypes/Entities/Clothing/Uniforms/jumpsuits.yml # Resources/Prototypes/Entities/Mobs/NPCs/animals.yml # Resources/Prototypes/Entities/Mobs/Player/silicon.yml # Resources/Prototypes/Entities/Mobs/Species/base.yml # Resources/Prototypes/Entities/Mobs/Species/slime.yml # Resources/Prototypes/Entities/Mobs/Species/vox.yml # Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml # Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_bottles.yml # Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml # Resources/Prototypes/Entities/Objects/Devices/Electronics/signaller.yml # Resources/Prototypes/Entities/Objects/Devices/nuke.yml # Resources/Prototypes/Entities/Objects/Devices/pda.yml # Resources/Prototypes/Entities/Objects/Fun/toys.yml # Resources/Prototypes/Entities/Objects/Materials/Sheets/glass.yml # Resources/Prototypes/Entities/Objects/Materials/parts.yml # Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml # Resources/Prototypes/Entities/Objects/Misc/implanters.yml # Resources/Prototypes/Entities/Objects/Misc/kudzu.yml # Resources/Prototypes/Entities/Objects/Misc/rubber_stamp.yml # Resources/Prototypes/Entities/Objects/Shields/shields.yml # Resources/Prototypes/Entities/Objects/Specific/Hydroponics/tools.yml # Resources/Prototypes/Entities/Objects/Specific/Medical/handheld_crew_monitor.yml # Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml # Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml # Resources/Prototypes/Entities/Objects/Weapons/Bombs/firebomb.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/shotgun.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml # Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml # Resources/Prototypes/Entities/Structures/Decoration/curtains.yml # Resources/Prototypes/Entities/Structures/Doors/Airlocks/access.yml # Resources/Prototypes/Entities/Structures/Doors/MaterialDoors/material_doors.yml # Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml # Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml # Resources/Prototypes/Entities/Structures/Machines/lathe.yml # Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml # Resources/Prototypes/Entities/Structures/Specific/Anomaly/anomalies.yml # Resources/Prototypes/Entities/Structures/Storage/glass_box.yml # Resources/Prototypes/Entities/Structures/Wallmounts/fireaxe_cabinet.yml # Resources/Prototypes/Entities/Structures/Wallmounts/switch.yml # Resources/Prototypes/Entities/Structures/Walls/asteroid.yml # Resources/Prototypes/Entities/Structures/Walls/grille.yml # Resources/Prototypes/Entities/Structures/Walls/walls.yml # Resources/Prototypes/Entities/Structures/Windows/window.yml # Resources/Prototypes/Entities/Structures/stairs.yml # Resources/Prototypes/GameRules/events.yml # Resources/Prototypes/Hydroponics/seeds.yml # Resources/Prototypes/Maps/saltern.yml # Resources/Prototypes/Reagents/biological.yml # Resources/Prototypes/Reagents/fun.yml # Resources/Prototypes/Recipes/Construction/Graphs/utilities/solarpanel.yml # Resources/Prototypes/Recipes/Construction/weapons.yml # Resources/Prototypes/Recipes/Crafting/improvised.yml # Resources/Prototypes/Recipes/Lathes/clothing.yml # Resources/Prototypes/Recipes/Reactions/fun.yml # Resources/Prototypes/Research/arsenal.yml # Resources/Prototypes/Roles/Jobs/Engineering/technical_assistant.yml # Resources/Prototypes/Roles/Jobs/Fun/emergencyresponseteam.yml # Resources/Prototypes/Roles/Jobs/Medical/medical_intern.yml # Resources/Prototypes/Roles/Jobs/Medical/paramedic.yml # Resources/Prototypes/Roles/Jobs/Science/research_assistant.yml # Resources/Prototypes/Roles/Jobs/Security/detective.yml # Resources/Prototypes/Roles/Jobs/Security/security_cadet.yml # Resources/Prototypes/Roles/Jobs/departments.yml # Resources/Prototypes/Species/human.yml # Resources/Prototypes/Species/vox.yml # Resources/Prototypes/Stacks/Materials/materials.yml # Resources/Prototypes/StatusEffects/health.yml # Resources/Prototypes/Tiles/plating.yml # Resources/Prototypes/Voice/speech_emote_sounds.yml # Resources/Prototypes/Voice/speech_emotes.yml # Resources/Prototypes/explosion.yml # Resources/Prototypes/game_presets.yml # Resources/Prototypes/lobbyscreens.yml # Resources/Prototypes/secret_weights.yml # Resources/Prototypes/tags.yml # Resources/ServerInfo/Guidebook/Jobs.xml # Resources/ServerInfo/Guidebook/Science/ArtifactReports.xml # Resources/Textures/Clothing/Belt/emt.rsi/meta.json # Resources/Textures/Clothing/Head/Hats/beret_medic.rsi/meta.json # Resources/Textures/Clothing/Head/Hats/beret_qm.rsi/meta.json # Resources/Textures/Clothing/Head/Soft/bluesoft_flipped.rsi/meta.json # Resources/Textures/Clothing/Head/Soft/corpsoft_flipped.rsi/meta.json # Resources/Textures/Clothing/Head/Soft/greensoft_flipped.rsi/meta.json # Resources/Textures/Clothing/Head/Soft/greysoft_flipped.rsi/meta.json # Resources/Textures/Clothing/Head/Soft/paramedicsoft_flipped.rsi/meta.json # Resources/Textures/Clothing/Mask/neckgaiterred.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/slayer.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/syndicate.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Suits/syndicate.rsi/meta.json # Resources/Textures/Clothing/Uniforms/Jumpsuit/qmformal.rsi/meta.json # Resources/Textures/Decals/Overlays/greyscale.rsi/checkerNESW.png # Resources/Textures/Decals/Overlays/greyscale.rsi/checkerNWSE.png # Resources/Textures/Decals/Overlays/greyscale.rsi/fulltile_overlay.png # Resources/Textures/Decals/Overlays/greyscale.rsi/halftile_overlay.png # Resources/Textures/Decals/Overlays/greyscale.rsi/halftile_overlay_180.png # Resources/Textures/Decals/Overlays/greyscale.rsi/halftile_overlay_270.png # Resources/Textures/Decals/Overlays/greyscale.rsi/halftile_overlay_90.png # Resources/Textures/Decals/Overlays/greyscale.rsi/quartertile_overlay.png # Resources/Textures/Decals/Overlays/greyscale.rsi/quartertile_overlay_180.png # Resources/Textures/Decals/Overlays/greyscale.rsi/quartertile_overlay_270.png # Resources/Textures/Decals/Overlays/greyscale.rsi/quartertile_overlay_90.png # Resources/Textures/Decals/Overlays/greyscale.rsi/threequartertile_overlay.png # Resources/Textures/Decals/Overlays/greyscale.rsi/threequartertile_overlay_180.png # Resources/Textures/Decals/Overlays/greyscale.rsi/threequartertile_overlay_270.png # Resources/Textures/Decals/Overlays/greyscale.rsi/threequartertile_overlay_90.png # Resources/Textures/Interface/Misc/job_icons.rsi/meta.json # Resources/Textures/Interface/emotions.svg.192dpi.png.yml # Resources/Textures/LobbyScreens/dead-in-space.png.yml # Resources/Textures/LobbyScreens/doomed.webp.yml # Resources/Textures/LobbyScreens/pharmacy.png.yml # Resources/Textures/LobbyScreens/pharmacy.webp.yml # Resources/Textures/LobbyScreens/robotics.webp.yml # Resources/Textures/LobbyScreens/supermatter.png.yml # Resources/Textures/LobbyScreens/susstation.png.yml # Resources/Textures/LobbyScreens/warden.png.yml # Resources/Textures/LobbyScreens/warden.webp.yml # Resources/Textures/Mobs/Customization/human_hair.rsi/meta.json # Resources/Textures/Mobs/Effects/brute_damage.rsi/LLeg_Brute_40.png # Resources/Textures/Mobs/Effects/brute_damage.rsi/RLeg_Brute_40.png # Resources/Textures/Objects/Devices/nuke.rsi/meta.json # Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed.png # Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png # Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png # Resources/Textures/Objects/Misc/books.rsi/meta.json # Resources/Textures/Objects/Misc/bureaucracy.rsi/paper_stamp-lawyer.png # Resources/Textures/Objects/Storage/boxes.rsi/meta.json # Resources/Textures/Objects/Tools/t-ray.rsi/tray-off.png # Resources/Textures/Objects/Tools/t-ray.rsi/tray-on.png # Resources/Textures/Objects/Weapons/Guns/Battery/mini-ebow.rsi/bolt.png # Resources/Textures/Structures/Doors/Airlocks/Standard/external.rsi/emergency_open_unlit.png # Resources/Textures/Structures/Doors/Airlocks/Standard/shuttle_syndicate.rsi/emergency_open_unlit.png # Resources/Textures/Structures/Doors/Windoors/plasma.rsi/emergency_unlit.png # Resources/Textures/Structures/Doors/Windoors/uranium.rsi/emergency_unlit.png # Resources/Textures/Structures/Power/Generation/Singularity/emitter.rsi/locked.png # Resources/Textures/Tiles/attributions.yml # Resources/Textures/Tiles/shuttleblue.png # Resources/Textures/Tiles/shuttleorange.png # Resources/Textures/Tiles/shuttlepurple.png # Resources/Textures/Tiles/shuttlered.png # Resources/Textures/Tiles/shuttlewhite.png # Resources/Textures/White/Fluff/DOOMMAX/cap_cap.rsi/meta.json # Resources/Textures/White/Fluff/HSKveez/hardsuit.rsi/meta.json # Resources/Textures/White/Fluff/Vtergot/strictgloves.rsi/meta.json # Resources/clientCommandPerms.yml # Resources/migration.yml
461 lines
16 KiB
C#
461 lines
16 KiB
C#
using System.Threading;
|
|
using Content.Server.DeviceNetwork;
|
|
using Content.Server.DeviceNetwork.Components;
|
|
using Content.Server.Screens.Components;
|
|
using Content.Server.Shuttles.Components;
|
|
using Content.Server.Shuttles.Events;
|
|
using Content.Shared.UserInterface;
|
|
using Content.Shared.Access;
|
|
using Content.Shared.CCVar;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.DeviceNetwork;
|
|
using Content.Shared.DeviceNetwork;
|
|
using Content.Shared.Emag.Systems;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Shuttles.BUIStates;
|
|
using Content.Shared.Shuttles.Events;
|
|
using Content.Shared.Shuttles.Systems;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Player;
|
|
using Timer = Robust.Shared.Timing.Timer;
|
|
|
|
namespace Content.Server.Shuttles.Systems;
|
|
|
|
public sealed partial class EmergencyShuttleSystem
|
|
{
|
|
/*
|
|
* Handles the emergency shuttle's console and early launching.
|
|
*/
|
|
|
|
/// <summary>
|
|
/// Has the emergency shuttle arrived?
|
|
/// </summary>
|
|
public bool EmergencyShuttleArrived { get; private set; }
|
|
|
|
public bool EarlyLaunchAuthorized { get; private set; }
|
|
|
|
/// <summary>
|
|
/// How much time remaining until the shuttle consoles for emergency shuttles are unlocked?
|
|
/// </summary>
|
|
private float _consoleAccumulator = float.MinValue;
|
|
|
|
/// <summary>
|
|
/// How long after the transit is over to end the round.
|
|
/// </summary>
|
|
private readonly TimeSpan _bufferTime = TimeSpan.FromSeconds(5);
|
|
|
|
/// <summary>
|
|
/// <see cref="CCVars.EmergencyShuttleMinTransitTime"/>
|
|
/// </summary>
|
|
public float MinimumTransitTime { get; private set; }
|
|
|
|
/// <summary>
|
|
/// <see cref="CCVars.EmergencyShuttleMaxTransitTime"/>
|
|
/// </summary>
|
|
public float MaximumTransitTime { get; private set; }
|
|
|
|
/// <summary>
|
|
/// How long it will take for the emergency shuttle to arrive at CentComm.
|
|
/// </summary>
|
|
public float TransitTime { get; private set; }
|
|
|
|
/// <summary>
|
|
/// <see cref="CCVars.EmergencyShuttleAuthorizeTime"/>
|
|
/// </summary>
|
|
private float _authorizeTime;
|
|
|
|
private CancellationTokenSource? _roundEndCancelToken;
|
|
|
|
[ValidatePrototypeId<AccessLevelPrototype>]
|
|
private const string EmergencyRepealAllAccess = "EmergencyShuttleRepealAll";
|
|
|
|
private static readonly Color DangerColor = Color.Red;
|
|
|
|
/// <summary>
|
|
/// Have the emergency shuttles been authorised to launch at CentCom?
|
|
/// </summary>
|
|
private bool _launchedShuttles;
|
|
|
|
/// <summary>
|
|
/// Have the emergency shuttles left for CentCom?
|
|
/// </summary>
|
|
public bool ShuttlesLeft;
|
|
|
|
/// <summary>
|
|
/// Have we announced the launch?
|
|
/// </summary>
|
|
private bool _announced;
|
|
|
|
private void InitializeEmergencyConsole()
|
|
{
|
|
Subs.CVar(_configManager, CCVars.EmergencyShuttleMinTransitTime, SetMinTransitTime, true);
|
|
Subs.CVar(_configManager, CCVars.EmergencyShuttleMaxTransitTime, SetMaxTransitTime, true);
|
|
Subs.CVar(_configManager, CCVars.EmergencyShuttleAuthorizeTime, SetAuthorizeTime, true);
|
|
SubscribeLocalEvent<EmergencyShuttleConsoleComponent, ComponentStartup>(OnEmergencyStartup);
|
|
SubscribeLocalEvent<EmergencyShuttleConsoleComponent, EmergencyShuttleAuthorizeMessage>(OnEmergencyAuthorize);
|
|
SubscribeLocalEvent<EmergencyShuttleConsoleComponent, EmergencyShuttleRepealMessage>(OnEmergencyRepeal);
|
|
SubscribeLocalEvent<EmergencyShuttleConsoleComponent, EmergencyShuttleRepealAllMessage>(OnEmergencyRepealAll);
|
|
SubscribeLocalEvent<EmergencyShuttleConsoleComponent, ActivatableUIOpenAttemptEvent>(OnEmergencyOpenAttempt);
|
|
SubscribeLocalEvent<EmergencyShuttleConsoleComponent, GotEmaggedEvent>(OnEmag); // WD
|
|
}
|
|
|
|
// ReSharper disable once IdentifierTypo
|
|
private void OnEmag(EntityUid uid, EmergencyShuttleConsoleComponent component, ref GotEmaggedEvent args) // WD
|
|
{
|
|
EarlyLaunch();
|
|
}
|
|
|
|
private void OnEmergencyOpenAttempt(
|
|
EntityUid uid,
|
|
EmergencyShuttleConsoleComponent component,
|
|
ActivatableUIOpenAttemptEvent args)
|
|
{
|
|
// I'm hoping ActivatableUI checks it's open before allowing these messages.
|
|
if (!_configManager.GetCVar(CCVars.EmergencyEarlyLaunchAllowed))
|
|
{
|
|
args.Cancel();
|
|
_popup.PopupEntity(Loc.GetString("emergency-shuttle-console-no-early-launches"), uid, args.User);
|
|
}
|
|
}
|
|
|
|
private void SetAuthorizeTime(float obj)
|
|
{
|
|
_authorizeTime = obj;
|
|
}
|
|
|
|
private void SetMinTransitTime(float obj)
|
|
{
|
|
MinimumTransitTime = obj;
|
|
MaximumTransitTime = Math.Max(MaximumTransitTime, MinimumTransitTime);
|
|
}
|
|
|
|
private void SetMaxTransitTime(float obj)
|
|
{
|
|
MaximumTransitTime = Math.Max(MinimumTransitTime, obj);
|
|
}
|
|
|
|
private void OnEmergencyStartup(EntityUid uid, EmergencyShuttleConsoleComponent component, ComponentStartup args)
|
|
{
|
|
UpdateConsoleState(uid, component);
|
|
}
|
|
|
|
private void UpdateEmergencyConsole(float frameTime)
|
|
{
|
|
// Add some buffer time so eshuttle always first.
|
|
var minTime = -(TransitTime - (ShuttleSystem.DefaultStartupTime + ShuttleSystem.DefaultTravelTime + 1f));
|
|
|
|
// TODO: I know this is shit but I already just cleaned up a billion things.
|
|
if (_consoleAccumulator < minTime)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_consoleAccumulator -= frameTime;
|
|
|
|
// No early launch but we're under the timer.
|
|
if (!_launchedShuttles && _consoleAccumulator <= _authorizeTime)
|
|
{
|
|
if (!EarlyLaunchAuthorized)
|
|
AnnounceLaunch();
|
|
}
|
|
|
|
// Imminent departure
|
|
if (!_launchedShuttles && _consoleAccumulator <= ShuttleSystem.DefaultStartupTime)
|
|
{
|
|
_launchedShuttles = true;
|
|
|
|
var dataQuery = AllEntityQuery<StationEmergencyShuttleComponent>();
|
|
|
|
while (dataQuery.MoveNext(out var stationUid, out var comp))
|
|
{
|
|
if (!TryComp<ShuttleComponent>(comp.EmergencyShuttle, out var shuttle) ||
|
|
!TryComp<StationCentcommComponent>(stationUid, out var centcomm))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (!Deleted(centcomm.Entity))
|
|
{
|
|
_shuttle.FTLToDock(comp.EmergencyShuttle.Value, shuttle,
|
|
centcomm.Entity.Value, _consoleAccumulator, TransitTime);
|
|
|
|
continue;
|
|
}
|
|
|
|
if (!Deleted(centcomm.MapEntity))
|
|
{
|
|
// TODO: Need to get non-overlapping positions.
|
|
_shuttle.FTLToCoordinates(comp.EmergencyShuttle.Value, shuttle,
|
|
new EntityCoordinates(centcomm.MapEntity.Value,
|
|
_random.NextVector2(1000f)), _consoleAccumulator, TransitTime);
|
|
}
|
|
}
|
|
|
|
var podQuery = AllEntityQuery<EscapePodComponent>();
|
|
|
|
// Stagger launches coz funny
|
|
while (podQuery.MoveNext(out _, out var pod))
|
|
{
|
|
pod.LaunchTime = _timing.CurTime + TimeSpan.FromSeconds(_random.NextFloat(0.05f, 0.75f));
|
|
}
|
|
}
|
|
|
|
var podLaunchQuery = EntityQueryEnumerator<EscapePodComponent, ShuttleComponent>();
|
|
|
|
while (podLaunchQuery.MoveNext(out var uid, out var pod, out var shuttle))
|
|
{
|
|
var stationUid = _station.GetOwningStation(uid);
|
|
|
|
if (!TryComp<StationCentcommComponent>(stationUid, out var centcomm) ||
|
|
Deleted(centcomm.Entity) ||
|
|
pod.LaunchTime == null ||
|
|
pod.LaunchTime > _timing.CurTime)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// Don't dock them. If you do end up doing this then stagger launch.
|
|
_shuttle.FTLToDock(uid, shuttle, centcomm.Entity.Value, hyperspaceTime: TransitTime);
|
|
RemCompDeferred<EscapePodComponent>(uid);
|
|
}
|
|
|
|
// Departed
|
|
if (!ShuttlesLeft && _consoleAccumulator <= 0f)
|
|
{
|
|
ShuttlesLeft = true;
|
|
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-left",
|
|
("transitTime", $"{TransitTime:0}")));
|
|
|
|
Timer.Spawn((int) (TransitTime * 1000) + _bufferTime.Milliseconds, () => _roundEnd.EndRound(),
|
|
_roundEndCancelToken?.Token ?? default);
|
|
}
|
|
|
|
// All the others.
|
|
if (_consoleAccumulator < minTime)
|
|
{
|
|
var query = AllEntityQuery<StationCentcommComponent, TransformComponent>();
|
|
|
|
// Guarantees that emergency shuttle arrives first before anyone else can FTL.
|
|
while (query.MoveNext(out var comp, out var centcommXform))
|
|
{
|
|
if (Deleted(comp.Entity))
|
|
continue;
|
|
|
|
if (_shuttle.TryAddFTLDestination(centcommXform.MapID, true, out var ftlComp))
|
|
{
|
|
_shuttle.SetFTLWhitelist((centcommXform.MapUid!.Value, ftlComp), null);
|
|
}
|
|
}
|
|
|
|
SendRoundStatus(EarlyLaunchAuthorized
|
|
? "shuttle_escaped"
|
|
: "shuttle_left");
|
|
}
|
|
}
|
|
|
|
private void OnEmergencyRepealAll(
|
|
EntityUid uid,
|
|
EmergencyShuttleConsoleComponent component,
|
|
EmergencyShuttleRepealAllMessage args)
|
|
{
|
|
var player = args.Session.AttachedEntity;
|
|
if (player == null) return;
|
|
|
|
if (!_reader.FindAccessTags(player.Value).Contains(EmergencyRepealAllAccess))
|
|
{
|
|
_popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), player.Value, PopupType.Medium);
|
|
return;
|
|
}
|
|
|
|
if (component.AuthorizedEntities.Count == 0)
|
|
return;
|
|
|
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.High,
|
|
$"Emergency shuttle early launch REPEAL ALL by {args.Session:user}");
|
|
|
|
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-console-auth-revoked",
|
|
("remaining", component.AuthorizationsRequired)));
|
|
|
|
component.AuthorizedEntities.Clear();
|
|
UpdateAllEmergencyConsoles();
|
|
}
|
|
|
|
private void OnEmergencyRepeal(
|
|
EntityUid uid,
|
|
EmergencyShuttleConsoleComponent component,
|
|
EmergencyShuttleRepealMessage args)
|
|
{
|
|
var player = args.Session.AttachedEntity;
|
|
if (player == null)
|
|
return;
|
|
|
|
if (!_idSystem.TryFindIdCard(player.Value, out var idCard) || !_reader.IsAllowed(idCard, uid))
|
|
{
|
|
_popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), player.Value, PopupType.Medium);
|
|
return;
|
|
}
|
|
|
|
// TODO: This is fucking bad
|
|
if (!component.AuthorizedEntities.Remove(MetaData(idCard).EntityName))
|
|
return;
|
|
|
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.High,
|
|
$"Emergency shuttle early launch REPEAL by {args.Session:user}");
|
|
|
|
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;
|
|
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-console-auth-revoked",
|
|
("remaining", remaining)));
|
|
|
|
CheckForLaunch(component);
|
|
UpdateAllEmergencyConsoles();
|
|
}
|
|
|
|
private void OnEmergencyAuthorize(
|
|
EntityUid uid,
|
|
EmergencyShuttleConsoleComponent component,
|
|
EmergencyShuttleAuthorizeMessage args)
|
|
{
|
|
var player = args.Session.AttachedEntity;
|
|
if (player == null)
|
|
return;
|
|
|
|
if (!_idSystem.TryFindIdCard(player.Value, out var idCard) || !_reader.IsAllowed(idCard, uid))
|
|
{
|
|
_popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), args.Session, PopupType.Medium);
|
|
return;
|
|
}
|
|
|
|
// TODO: This is fucking bad
|
|
if (!component.AuthorizedEntities.Add(MetaData(idCard).EntityName))
|
|
return;
|
|
|
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.High,
|
|
$"Emergency shuttle early launch AUTH by {args.Session:user}");
|
|
|
|
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;
|
|
|
|
if (remaining > 0)
|
|
_chatSystem.DispatchGlobalAnnouncement(
|
|
Loc.GetString("emergency-shuttle-console-auth-left", ("remaining", remaining)),
|
|
playSound: false, colorOverride: DangerColor);
|
|
|
|
if (!CheckForLaunch(component))
|
|
_audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), recordReplay: true);
|
|
|
|
UpdateAllEmergencyConsoles();
|
|
}
|
|
|
|
private void CleanupEmergencyConsole()
|
|
{
|
|
// Realistically most of this shit needs moving to a station component so each station has their own emergency shuttle
|
|
// and timer and all that jazz so I don't really care about debugging if it works on cleanup vs start.
|
|
_announced = false;
|
|
ShuttlesLeft = false;
|
|
_launchedShuttles = false;
|
|
_consoleAccumulator = float.MinValue;
|
|
EarlyLaunchAuthorized = false;
|
|
EmergencyShuttleArrived = false;
|
|
TransitTime = MinimumTransitTime + (MaximumTransitTime - MinimumTransitTime) * _random.NextFloat();
|
|
// Round to nearest 10
|
|
TransitTime = MathF.Round(TransitTime / 10f) * 10f;
|
|
}
|
|
|
|
private void UpdateAllEmergencyConsoles()
|
|
{
|
|
var query = AllEntityQuery<EmergencyShuttleConsoleComponent>();
|
|
while (query.MoveNext(out var uid, out var comp))
|
|
{
|
|
UpdateConsoleState(uid, comp);
|
|
}
|
|
}
|
|
|
|
private void UpdateConsoleState(EntityUid uid, EmergencyShuttleConsoleComponent component)
|
|
{
|
|
var auths = new List<string>();
|
|
|
|
foreach (var auth in component.AuthorizedEntities)
|
|
{
|
|
auths.Add(auth);
|
|
}
|
|
|
|
if (_uiSystem.TryGetUi(uid, EmergencyConsoleUiKey.Key, out var bui))
|
|
_uiSystem.SetUiState(
|
|
bui,
|
|
new EmergencyConsoleBoundUserInterfaceState()
|
|
{
|
|
EarlyLaunchTime = EarlyLaunchAuthorized
|
|
? _timing.CurTime + TimeSpan.FromSeconds(_consoleAccumulator)
|
|
: null,
|
|
Authorizations = auths,
|
|
AuthorizationsRequired = component.AuthorizationsRequired,
|
|
}
|
|
);
|
|
}
|
|
|
|
private bool CheckForLaunch(EmergencyShuttleConsoleComponent component)
|
|
{
|
|
if (component.AuthorizedEntities.Count < component.AuthorizationsRequired || EarlyLaunchAuthorized)
|
|
return false;
|
|
|
|
EarlyLaunch();
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Attempts to early launch the emergency shuttle if not already done.
|
|
/// </summary>
|
|
public bool EarlyLaunch()
|
|
{
|
|
if (EarlyLaunchAuthorized || !EmergencyShuttleArrived || _consoleAccumulator <= _authorizeTime) return false;
|
|
|
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.Extreme, $"Emergency shuttle launch authorized");
|
|
_consoleAccumulator = _authorizeTime;
|
|
EarlyLaunchAuthorized = true;
|
|
RaiseLocalEvent(new EmergencyShuttleAuthorizedEvent());
|
|
AnnounceLaunch();
|
|
UpdateAllEmergencyConsoles();
|
|
|
|
var time = TimeSpan.FromSeconds(_authorizeTime);
|
|
var shuttle = GetShuttle();
|
|
if (shuttle != null && TryComp<DeviceNetworkComponent>(shuttle, out var net))
|
|
{
|
|
var payload = new NetworkPayload
|
|
{
|
|
[ShuttleTimerMasks.ShuttleMap] = shuttle,
|
|
[ShuttleTimerMasks.SourceMap] = _roundEnd.GetStation(),
|
|
[ShuttleTimerMasks.DestMap] = _roundEnd.GetCentcomm(),
|
|
[ShuttleTimerMasks.ShuttleTime] = time,
|
|
[ShuttleTimerMasks.SourceTime] = time,
|
|
[ShuttleTimerMasks.DestTime] = time + TimeSpan.FromSeconds(TransitTime),
|
|
[ShuttleTimerMasks.Docked] = true
|
|
};
|
|
|
|
_deviceNetworkSystem.QueuePacket(shuttle.Value, null, payload, net.TransmitFrequency);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
private void AnnounceLaunch()
|
|
{
|
|
if (_announced) return;
|
|
|
|
_announced = true;
|
|
_chatSystem.DispatchGlobalAnnouncement(
|
|
Loc.GetString("emergency-shuttle-launch-time", ("consoleAccumulator", $"{_consoleAccumulator:0}")),
|
|
playSound: false,
|
|
colorOverride: DangerColor);
|
|
|
|
_audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), recordReplay: true);
|
|
}
|
|
|
|
public bool DelayEmergencyRoundEnd()
|
|
{
|
|
if (_roundEndCancelToken == null)
|
|
return false;
|
|
|
|
_roundEndCancelToken?.Cancel();
|
|
_roundEndCancelToken = null;
|
|
return true;
|
|
}
|
|
} |