Files
tbd-station-14/Content.Shared/Shuttles/Systems/SharedEmergencyShuttleSystem.cs
Winkarst-cpu ebfcddc62f Fix emergency evac shuttle console early launch mispredict (#39751)
* Fix

* Yes

* Mess

* Update

* Like that?
2025-09-10 15:56:18 +02:00

35 lines
1.2 KiB
C#

using Content.Shared.CCVar;
using Content.Shared.Popups;
using Content.Shared.Shuttles.Components;
using Content.Shared.UserInterface;
using Robust.Shared.Configuration;
namespace Content.Shared.Shuttles.Systems;
public abstract class SharedEmergencyShuttleSystem : EntitySystem
{
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;
[Dependency] protected readonly SharedPopupSystem Popup = default!;
private bool _emergencyEarlyLaunchAllowed;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EmergencyShuttleConsoleComponent, ActivatableUIOpenAttemptEvent>(OnEmergencyOpenAttempt);
Subs.CVar(ConfigManager, CCVars.EmergencyEarlyLaunchAllowed, value => _emergencyEarlyLaunchAllowed = value, true);
}
private void OnEmergencyOpenAttempt(Entity<EmergencyShuttleConsoleComponent> ent, ref ActivatableUIOpenAttemptEvent args)
{
// I'm hoping ActivatableUI checks it's open before allowing these messages.
if (_emergencyEarlyLaunchAllowed)
return;
args.Cancel();
Popup.PopupClient(Loc.GetString("emergency-shuttle-console-no-early-launches"), ent, args.User);
}
}