Adds emergency access to airlocks (#6500)

This commit is contained in:
WlarusFromDaSpace
2022-02-09 03:13:35 +00:00
committed by GitHub
parent 21e0cd4256
commit 50b1af08a2
57 changed files with 288 additions and 27 deletions

View File

@@ -46,6 +46,12 @@ namespace Content.Client.Doors
[DataField("openUnlitVisible")] [DataField("openUnlitVisible")]
private bool _openUnlitVisible = false; private bool _openUnlitVisible = false;
/// <summary>
/// Whether the door should have an emergency access layer
/// </summary>
[DataField("emergencyAccessLayer")]
private bool _emergencyAccessLayer = true;
private Animation CloseAnimation = default!; private Animation CloseAnimation = default!;
private Animation OpenAnimation = default!; private Animation OpenAnimation = default!;
private Animation DenyAnimation = default!; private Animation DenyAnimation = default!;
@@ -141,6 +147,7 @@ namespace Content.Client.Doors
var unlitVisible = true; var unlitVisible = true;
var boltedVisible = false; var boltedVisible = false;
var weldedVisible = false; var weldedVisible = false;
var emergencyLightsVisible = false;
if (animPlayer.HasRunningAnimation(AnimationKey)) if (animPlayer.HasRunningAnimation(AnimationKey))
{ {
@@ -192,11 +199,25 @@ namespace Content.Client.Doors
boltedVisible = true; boltedVisible = true;
} }
if (component.TryGetData(DoorVisuals.EmergencyLights, out bool eaLights) && eaLights)
{
emergencyLightsVisible = true;
}
if (!_simpleVisuals) if (!_simpleVisuals)
{ {
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible && state != DoorState.Closed && state != DoorState.Welded); sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible && state != DoorState.Closed && state != DoorState.Welded);
sprite.LayerSetVisible(DoorVisualLayers.BaseWelded, weldedVisible); sprite.LayerSetVisible(DoorVisualLayers.BaseWelded, weldedVisible);
sprite.LayerSetVisible(DoorVisualLayers.BaseBolted, unlitVisible && boltedVisible); sprite.LayerSetVisible(DoorVisualLayers.BaseBolted, unlitVisible && boltedVisible);
if (_emergencyAccessLayer)
{
sprite.LayerSetVisible(DoorVisualLayers.BaseEmergencyAccess,
emergencyLightsVisible
&& state != DoorState.Open
&& state != DoorState.Opening
&& state != DoorState.Closing
&& unlitVisible);
}
} }
} }
} }
@@ -207,5 +228,6 @@ namespace Content.Client.Doors
BaseUnlit, BaseUnlit,
BaseWelded, BaseWelded,
BaseBolted, BaseBolted,
BaseEmergencyAccess,
} }
} }

View File

@@ -5,6 +5,7 @@ using Content.Server.Construction;
using Content.Server.Construction.Components; using Content.Server.Construction.Components;
using Content.Server.Tools; using Content.Server.Tools;
using Content.Server.Tools.Components; using Content.Server.Tools.Components;
using Content.Server.Doors.Components;
using Content.Shared.Access.Components; using Content.Shared.Access.Components;
using Content.Shared.Access.Systems; using Content.Shared.Access.Systems;
using Content.Shared.Doors; using Content.Shared.Doors;
@@ -209,6 +210,10 @@ public sealed class DoorSystem : SharedDoorSystem
if (user == null || AccessType == AccessTypes.AllowAll) if (user == null || AccessType == AccessTypes.AllowAll)
return true; return true;
// If the door is on emergency access we skip the checks.
if (TryComp<SharedAirlockComponent>(uid, out var airlock) && airlock.EmergencyAccess)
return true;
if (!Resolve(uid, ref access, false)) if (!Resolve(uid, ref access, false))
return true; return true;

View File

@@ -14,8 +14,8 @@ namespace Content.Server.Remotes
public enum OperatingMode : byte public enum OperatingMode : byte
{ {
OpenClose, OpenClose,
ToggleBolts ToggleBolts,
// ToggleEmergencyAccess ToggleEmergencyAccess
} }
} }
} }

View File

@@ -20,6 +20,7 @@ namespace Content.Server.Remotes
[Dependency] private readonly SharedDoorSystem _sharedDoorSystem = default!; [Dependency] private readonly SharedDoorSystem _sharedDoorSystem = default!;
[Dependency] private readonly DoorSystem _doorSystem = default!; [Dependency] private readonly DoorSystem _doorSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedAirlockSystem _sharedAirlockSystem = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -38,15 +39,13 @@ namespace Content.Server.Remotes
_popupSystem.PopupEntity(Loc.GetString("door-remote-switch-state-toggle-bolts"), args.User, Filter.Entities(args.User)); _popupSystem.PopupEntity(Loc.GetString("door-remote-switch-state-toggle-bolts"), args.User, Filter.Entities(args.User));
break; break;
case DoorRemoteComponent.OperatingMode.ToggleBolts: case DoorRemoteComponent.OperatingMode.ToggleBolts:
component.Mode = DoorRemoteComponent.OperatingMode.OpenClose; // TODO: Swítch to ToggleEmergencyAcces when EA is implemented component.Mode = DoorRemoteComponent.OperatingMode.ToggleEmergencyAccess;
_popupSystem.PopupEntity(Loc.GetString("door-remote-switch-state-open-close"), args.User, Filter.Entities(args.User)); // TODO: See the above comment _popupSystem.PopupEntity(Loc.GetString("door-remote-switch-state-toggle-emergency-access"), args.User, Filter.Entities(args.User));
break; break;
/*
case DoorRemoteComponent.OperatingMode.ToggleEmergencyAccess: case DoorRemoteComponent.OperatingMode.ToggleEmergencyAccess:
component.Mode = DoorRemoteComponent.OperatingMode.OpenClose; component.Mode = DoorRemoteComponent.OperatingMode.OpenClose;
_popupSystem.PopupEntity(Loc.GetString("door-remote-switch-state-open-close"), args.User, Filter.Entities(args.User)); _popupSystem.PopupEntity(Loc.GetString("door-remote-switch-state-open-close"), args.User, Filter.Entities(args.User));
break; break;
*/
} }
} }
@@ -88,6 +87,15 @@ namespace Content.Server.Remotes
} }
} }
} }
if (component.Mode == DoorRemoteComponent.OperatingMode.ToggleEmergencyAccess
&& airlockComponent.IsPowered())
{
if (_doorSystem.HasAccess(doorComponent.Owner, args.Used))
{
_sharedAirlockSystem.ToggleEmergencyAccess(airlockComponent);
}
}
} }
} }
} }

View File

@@ -204,7 +204,8 @@ public enum DoorVisuals
{ {
State, State,
Powered, Powered,
BoltLights BoltLights,
EmergencyLights,
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]

View File

@@ -13,6 +13,10 @@ public abstract class SharedAirlockComponent : Component
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
[DataField("safety")] [DataField("safety")]
public bool Safety = true; public bool Safety = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("emergencyAccess")]
public bool EmergencyAccess = false;
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]

View File

@@ -38,4 +38,19 @@ public abstract class SharedAirlockSystem : EntitySystem
if (airlock.Safety && DoorSystem.GetColliding(uid).Any()) if (airlock.Safety && DoorSystem.GetColliding(uid).Any())
args.Cancel(); args.Cancel();
} }
public void UpdateEmergencyLightStatus(SharedAirlockComponent component)
{
if (TryComp<AppearanceComponent>(component.Owner, out var appearanceComponent))
{
appearanceComponent.SetData(DoorVisuals.EmergencyLights, component.EmergencyAccess);
}
}
public void ToggleEmergencyAccess(SharedAirlockComponent component)
{
component.EmergencyAccess = !component.EmergencyAccess;
UpdateEmergencyLightStatus(component);
}
} }

View File

@@ -19,6 +19,9 @@
- state: bolted_unlit - state: bolted_unlit
shader: unshaded shader: unshaded
map: ["enum.DoorVisualLayers.BaseBolted"] map: ["enum.DoorVisualLayers.BaseBolted"]
- state: emergency_unlit
map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
shader: unshaded
- state: panel_open - state: panel_open
map: ["enum.WiresVisualLayers.MaintenancePanel"] map: ["enum.WiresVisualLayers.MaintenancePanel"]
- type: Physics - type: Physics

View File

@@ -20,6 +20,9 @@
- state: bolted_unlit - state: bolted_unlit
shader: unshaded shader: unshaded
map: ["enum.DoorVisualLayers.BaseBolted"] map: ["enum.DoorVisualLayers.BaseBolted"]
- state: emergency_unlit
shader: unshaded
map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
- state: panel_open - state: panel_open
map: ["enum.WiresVisualLayers.MaintenancePanel"] map: ["enum.WiresVisualLayers.MaintenancePanel"]
- type: Wires - type: Wires

View File

@@ -78,6 +78,7 @@
visuals: visuals:
- type: AirlockVisualizer - type: AirlockVisualizer
animationTime: 0.6 animationTime: 0.6
emergencyAccessLayer: false
- type: WiresVisualizer - type: WiresVisualizer
- type: Wires - type: Wires
BoardName: "Firelock Control" BoardName: "Firelock Control"

View File

@@ -34,6 +34,9 @@
- state: bolted_unlit - state: bolted_unlit
shader: unshaded shader: unshaded
map: ["enum.DoorVisualLayers.BaseBolted"] map: ["enum.DoorVisualLayers.BaseBolted"]
- state: emergency_unlit
shader: unshaded
map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
- state: panel_open - state: panel_open
map: ["enum.WiresVisualLayers.MaintenancePanel"] map: ["enum.WiresVisualLayers.MaintenancePanel"]
- type: ApcPowerReceiver - type: ApcPowerReceiver
@@ -123,6 +126,9 @@
- state: bolted_unlit - state: bolted_unlit
shader: unshaded shader: unshaded
map: [ "enum.DoorVisualLayers.BaseBolted" ] map: [ "enum.DoorVisualLayers.BaseBolted" ]
- state: emergency_unlit
shader: unshaded
map: [ "enum.DoorVisualLayers.BaseEmergencyAccess" ]
- state: panel_open - state: panel_open
map: [ "enum.WiresVisualLayers.MaintenancePanel" ] map: [ "enum.WiresVisualLayers.MaintenancePanel" ]
visible: false visible: false

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -154,6 +154,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -130,6 +130,15 @@
}, },
{ {
"name": "welded_open" "name": "welded_open"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -109,15 +109,6 @@
] ]
] ]
}, },
{
"name": "emergency_unlit",
"delays": [
[
12,
12
]
]
},
{ {
"name": "open" "name": "open"
}, },
@@ -244,6 +235,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -154,6 +154,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -145,6 +145,15 @@
}, },
{ {
"name": "welded_open" "name": "welded_open"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -181,6 +181,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -129,6 +129,15 @@
}, },
{ {
"name": "welded" "name": "welded"
},
{
"name": "emergency_unlit",
"delays": [
[
0.4,
0.4
]
]
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -163,6 +163,10 @@
{ {
"name":"secure_underlay", "name":"secure_underlay",
"directions":4 "directions":4
},
{
"name": "emergency_unlit",
"directions": 4
} }
] ]
} }