Files
wylab-station-14/Content.Shared/Shuttles/Systems/SharedEmergencyShuttleSystem.cs
slarticodefast ed7c004de2 Fix looking at verbs causing sounds or popups (#41609)
* fix verb popups

* spelling
2025-11-28 21:41:44 +00:00

37 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();
if (!args.Silent)
Popup.PopupClient(Loc.GetString("emergency-shuttle-console-no-early-launches"), ent, args.User);
}
}