# Conflicts: # Content.Client/Lobby/UI/Loadouts/LoadoutWindow.xaml.cs # Content.Server/Connection/ConnectionManager.cs # Content.Server/GameTicking/GameTicker.Spawning.cs # Content.Server/Shuttles/Systems/ArrivalsSystem.cs # Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs # Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs # Content.Server/Station/Systems/StationSpawningSystem.cs # Content.Shared/Chat/SharedChatSystem.cs # Content.Shared/UserInterface/ActivatableUIComponent.cs # Resources/Prototypes/Datasets/Names/ai.yml # Resources/Prototypes/Datasets/adjectives.yml # Resources/Prototypes/Datasets/verbs.yml # Resources/Prototypes/Entities/Clothing/Shoes/boots.yml # Resources/Prototypes/Entities/Clothing/Shoes/specific.yml # Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml # Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml # Resources/Prototypes/Entities/Stations/base.yml # Resources/Prototypes/Entities/Structures/Machines/lathe.yml # Resources/Prototypes/Maps/bagel.yml # Resources/Prototypes/Roles/Jobs/Science/borg.yml # Resources/Prototypes/Roles/Jobs/Security/security_cadet.yml # Resources/Textures/Clothing/Head/Helmets/light_riot.rsi/equipped-HELMET.png # Resources/Textures/Clothing/Head/Helmets/light_riot.rsi/icon.png # Resources/Textures/Clothing/Head/Helmets/light_riot.rsi/meta.json # Resources/Textures/Interface/Misc/job_icons.rsi/meta.json # Resources/Textures/Objects/Misc/bureaucracy.rsi/meta.json # Resources/Textures/Structures/Wallmounts/barsign.rsi/officerbeersky.png # Resources/Textures/Structures/Wallmounts/signs.rsi/anomaly.png # Resources/Textures/Structures/Wallmounts/signs.rsi/meta.json # SpaceStation14.sln
94 lines
3 KiB
C#
94 lines
3 KiB
C#
using Content.Server.DeviceLinking.Events;
|
|
using Content.Server.Power.Components;
|
|
using Content.Server.Wires;
|
|
using Content.Shared.Doors.Components;
|
|
using Content.Shared.Doors.Systems;
|
|
using Content.Shared.Interaction;
|
|
using Content.Shared.Power;
|
|
using Content.Shared.Wires;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Server.Doors.Systems;
|
|
|
|
public sealed class AirlockSystem : SharedAirlockSystem
|
|
{
|
|
[Dependency] private readonly WiresSystem _wiresSystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<AirlockComponent, ComponentInit>(OnAirlockInit);
|
|
SubscribeLocalEvent<AirlockComponent, SignalReceivedEvent>(OnSignalReceived);
|
|
|
|
SubscribeLocalEvent<AirlockComponent, PowerChangedEvent>(OnPowerChanged);
|
|
SubscribeLocalEvent<AirlockComponent, ActivateInWorldEvent>(OnActivate, before: new[] { typeof(DoorSystem) });
|
|
}
|
|
|
|
private void OnAirlockInit(EntityUid uid, AirlockComponent component, ComponentInit args)
|
|
{
|
|
if (TryComp<ApcPowerReceiverComponent>(uid, out var receiverComponent))
|
|
{
|
|
Appearance.SetData(uid, DoorVisuals.Powered, receiverComponent.Powered);
|
|
Appearance.SetData(uid, DoorVisuals.ClosedLights, true); // Resprite-Airlocks
|
|
}
|
|
}
|
|
|
|
private void OnSignalReceived(EntityUid uid, AirlockComponent component, ref SignalReceivedEvent args)
|
|
{
|
|
if (args.Port == component.AutoClosePort)
|
|
{
|
|
component.AutoClose = false;
|
|
}
|
|
}
|
|
|
|
private void OnPowerChanged(EntityUid uid, AirlockComponent component, ref PowerChangedEvent args)
|
|
{
|
|
component.Powered = args.Powered;
|
|
Dirty(uid, component);
|
|
|
|
if (TryComp<AppearanceComponent>(uid, out var appearanceComponent))
|
|
{
|
|
Appearance.SetData(uid, DoorVisuals.Powered, args.Powered, appearanceComponent);
|
|
}
|
|
|
|
if (!TryComp(uid, out DoorComponent? door))
|
|
return;
|
|
|
|
if (!args.Powered)
|
|
{
|
|
// stop any scheduled auto-closing
|
|
if (door.State == DoorState.Open)
|
|
DoorSystem.SetNextStateChange(uid, null);
|
|
}
|
|
else
|
|
{
|
|
UpdateAutoClose(uid, door: door);
|
|
}
|
|
}
|
|
|
|
private void OnActivate(EntityUid uid, AirlockComponent component, ActivateInWorldEvent args)
|
|
{
|
|
if (args.Handled || !args.Complex)
|
|
return;
|
|
|
|
if (TryComp<WiresPanelComponent>(uid, out var panel) &&
|
|
panel.Open &&
|
|
TryComp<ActorComponent>(args.User, out var actor))
|
|
{
|
|
if (TryComp<WiresPanelSecurityComponent>(uid, out var wiresPanelSecurity) &&
|
|
!wiresPanelSecurity.WiresAccessible)
|
|
return;
|
|
|
|
_wiresSystem.OpenUserInterface(uid, actor.PlayerSession);
|
|
args.Handled = true;
|
|
return;
|
|
}
|
|
|
|
if (component.KeepOpenIfClicked)
|
|
{
|
|
// Disable auto close
|
|
component.AutoClose = false;
|
|
}
|
|
}
|
|
}
|