Add access locks to gas canisters (#10575)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.Components
|
namespace Content.Server.Atmos.Piping.Unary.Components
|
||||||
{
|
{
|
||||||
@@ -52,5 +53,8 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
|||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField("releaseValve")]
|
[DataField("releaseValve")]
|
||||||
public bool ReleaseValve { get; set; } = false;
|
public bool ReleaseValve { get; set; } = false;
|
||||||
|
|
||||||
|
[DataField("accessDeniedSound")]
|
||||||
|
public SoundSpecifier AccessDeniedSound = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ using Content.Server.Atmos.EntitySystems;
|
|||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.Atmos.Piping.Unary.Components;
|
using Content.Server.Atmos.Piping.Unary.Components;
|
||||||
using Content.Server.Cargo.Systems;
|
using Content.Server.Cargo.Systems;
|
||||||
|
using Content.Server.Lock;
|
||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.NodeContainer.NodeGroups;
|
using Content.Server.NodeContainer.NodeGroups;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
|
using Content.Server.Popups;
|
||||||
|
using Content.Server.Storage.Components;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
using Content.Shared.Atmos.Piping.Binary.Components;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
@@ -15,6 +18,7 @@ using Content.Shared.Interaction;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -25,6 +29,9 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audioSys = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -43,6 +50,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasCanisterComponent, GasCanisterHoldingTankEjectMessage>(OnHoldingTankEjectMessage);
|
SubscribeLocalEvent<GasCanisterComponent, GasCanisterHoldingTankEjectMessage>(OnHoldingTankEjectMessage);
|
||||||
SubscribeLocalEvent<GasCanisterComponent, GasCanisterChangeReleasePressureMessage>(OnCanisterChangeReleasePressure);
|
SubscribeLocalEvent<GasCanisterComponent, GasCanisterChangeReleasePressureMessage>(OnCanisterChangeReleasePressure);
|
||||||
SubscribeLocalEvent<GasCanisterComponent, GasCanisterChangeReleaseValveMessage>(OnCanisterChangeReleaseValve);
|
SubscribeLocalEvent<GasCanisterComponent, GasCanisterChangeReleaseValveMessage>(OnCanisterChangeReleaseValve);
|
||||||
|
SubscribeLocalEvent<GasCanisterComponent, LockToggledEvent>(OnLockToggled);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +81,9 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
{
|
{
|
||||||
containerManager.MakeContainer<ContainerSlot>(canister.ContainerName);
|
containerManager.MakeContainer<ContainerSlot>(canister.ContainerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TryComp<LockComponent>(uid, out var lockComponent))
|
||||||
|
_appearanceSystem.SetData(uid, GasCanisterVisuals.Locked, lockComponent.Locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DirtyUI(EntityUid uid,
|
private void DirtyUI(EntityUid uid,
|
||||||
@@ -215,6 +226,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
|
if (TryComp<LockComponent>(uid, out var lockComponent) && lockComponent.Locked)
|
||||||
|
{
|
||||||
|
_popupSystem.PopupEntity(Loc.GetString("gas-canister-popup-denied"), uid, Filter.Entities(args.User));
|
||||||
|
if (component.AccessDeniedSound != null)
|
||||||
|
_audioSys.PlayPvs(component.AccessDeniedSound, uid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession);
|
_userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
@@ -225,6 +243,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
|
if (TryComp<LockComponent>(uid, out var lockComponent) && lockComponent.Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
_userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession);
|
_userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
@@ -301,12 +321,17 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
args.Price += _atmosphereSystem.GetPrice(component.Air);
|
args.Price += _atmosphereSystem.GetPrice(component.Air);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the gas mixture for the gas analyzer
|
/// Returns the gas mixture for the gas analyzer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnAnalyzed(EntityUid uid, GasCanisterComponent component, GasAnalyzerScanEvent args)
|
private void OnAnalyzed(EntityUid uid, GasCanisterComponent component, GasAnalyzerScanEvent args)
|
||||||
{
|
{
|
||||||
args.GasMixtures = new Dictionary<string, GasMixture?> { {Name(uid), component.Air} };
|
args.GasMixtures = new Dictionary<string, GasMixture?> { {Name(uid), component.Air} };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnLockToggled(EntityUid uid, GasCanisterComponent component, LockToggledEvent args)
|
||||||
|
{
|
||||||
|
_appearanceSystem.SetData(uid, GasCanisterVisuals.Locked, args.Locked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace Content.Shared.Atmos.Piping.Binary.Components
|
|||||||
{
|
{
|
||||||
PressureState,
|
PressureState,
|
||||||
TankInserted,
|
TankInserted,
|
||||||
|
Locked
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
gas-canister-bound-user-interface-title = Gas Canister
|
gas-canister-bound-user-interface-title = Gas Canister
|
||||||
|
|
||||||
|
# Popup
|
||||||
|
gas-canister-popup-denied = Access denied
|
||||||
|
|
||||||
# window
|
# window
|
||||||
|
|
||||||
gas-canister-window-ok-text = OK
|
gas-canister-window-ok-text = OK
|
||||||
|
|||||||
@@ -23,6 +23,10 @@
|
|||||||
tankInserted:
|
tankInserted:
|
||||||
False: { state: can-open, visible: false }
|
False: { state: can-open, visible: false }
|
||||||
True: { state: can-open, visible: true }
|
True: { state: can-open, visible: true }
|
||||||
|
enum.GasCanisterVisuals.Locked:
|
||||||
|
locked:
|
||||||
|
False: { state: can-unlocked, shader: "unshaded" }
|
||||||
|
True: { state: can-locked, shader: "unshaded" }
|
||||||
enum.GasCanisterVisuals.PressureState:
|
enum.GasCanisterVisuals.PressureState:
|
||||||
pressureLight:
|
pressureLight:
|
||||||
0: { state: can-o0, shader: "unshaded" }
|
0: { state: can-o0, shader: "unshaded" }
|
||||||
@@ -81,6 +85,10 @@
|
|||||||
- type: GasCanister
|
- type: GasCanister
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 1000
|
price: 1000
|
||||||
|
- type: AccessReader
|
||||||
|
access: [["Atmospherics"], ["ResearchDirector"]]
|
||||||
|
- type: Lock
|
||||||
|
locked: false
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: GasCanister
|
parent: GasCanister
|
||||||
@@ -242,6 +250,8 @@
|
|||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: Lock
|
||||||
|
locked: true
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: GasCanister
|
parent: GasCanister
|
||||||
@@ -276,6 +286,8 @@
|
|||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- !type:DumpCanisterBehavior
|
- !type:DumpCanisterBehavior
|
||||||
|
- type: Lock
|
||||||
|
locked: true
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: GasCanister
|
parent: GasCanister
|
||||||
@@ -310,6 +322,8 @@
|
|||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: Lock
|
||||||
|
locked: true
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: GasCanister
|
parent: GasCanister
|
||||||
@@ -381,6 +395,8 @@
|
|||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: Lock
|
||||||
|
locked: true
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: GasCanister
|
parent: GasCanister
|
||||||
@@ -455,6 +471,8 @@
|
|||||||
max: 1
|
max: 1
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: Lock
|
||||||
|
locked: true
|
||||||
|
|
||||||
# Broke Entities
|
# Broke Entities
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@@ -22,6 +22,12 @@
|
|||||||
{
|
{
|
||||||
"name": "can-connector"
|
"name": "can-connector"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "can-locked"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "can-unlocked"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "can-o0",
|
"name": "can-o0",
|
||||||
"delays": [
|
"delays": [
|
||||||
|
|||||||
Reference in New Issue
Block a user