diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index 53735a53f0..99c59fea14 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -28,6 +28,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; + [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!; @@ -206,19 +207,19 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (canister.Air.Pressure < 10) { - appearance.SetData(GasCanisterVisuals.PressureState, 0); + _appearanceSystem.SetData(uid, GasCanisterVisuals.PressureState, 0, appearance); } else if (canister.Air.Pressure < Atmospherics.OneAtmosphere) { - appearance.SetData(GasCanisterVisuals.PressureState, 1); + _appearanceSystem.SetData(uid, GasCanisterVisuals.PressureState, 1, appearance); } else if (canister.Air.Pressure < (15 * Atmospherics.OneAtmosphere)) { - appearance.SetData(GasCanisterVisuals.PressureState, 2); + _appearanceSystem.SetData(uid, GasCanisterVisuals.PressureState, 2, appearance); } else { - appearance.SetData(GasCanisterVisuals.PressureState, 3); + _appearanceSystem.SetData(uid, GasCanisterVisuals.PressureState, 3, appearance); } } @@ -234,7 +235,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems return; } - _userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession); + _userInterfaceSystem.TryOpen(uid, GasCanisterUiKey.Key, actor.PlayerSession); args.Handled = true; } @@ -246,13 +247,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (TryComp(uid, out var lockComponent) && lockComponent.Locked) return; - _userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession); + _userInterfaceSystem.TryOpen(uid, GasCanisterUiKey.Key, actor.PlayerSession); args.Handled = true; } private void OnCanisterInteractUsing(EntityUid canister, GasCanisterComponent component, InteractUsingEvent args) { - var container = canister.EnsureContainer(component.ContainerName); + var container = _containerSystem.EnsureContainer(canister, component.ContainerName); // Container full. if (container.ContainedEntity != null) @@ -277,10 +278,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems DirtyUI(uid, component); - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) - return; - - appearance.SetData(GasCanisterVisuals.TankInserted, true); + _appearanceSystem.SetData(uid, GasCanisterVisuals.TankInserted, true); } private void OnCanisterContainerRemoved(EntityUid uid, GasCanisterComponent component, EntRemovedFromContainerMessage args) @@ -290,10 +288,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems DirtyUI(uid, component); - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) - return; - - appearance.SetData(GasCanisterVisuals.TankInserted, false); + _appearanceSystem.SetData(uid, GasCanisterVisuals.TankInserted, false); } /// diff --git a/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml b/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml index 72c80e8900..ba775473d0 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml @@ -53,6 +53,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: Damageable damageContainer: Inorganic damageModifierSet: Metallic @@ -124,6 +125,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior # Filled canisters, contain 1871.71051 moles each @@ -157,6 +159,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: entity parent: GasCanister @@ -187,6 +190,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: entity parent: GasCanister @@ -218,6 +222,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: entity parent: GasCanister @@ -250,6 +255,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: Lock locked: true @@ -322,6 +328,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: Lock locked: true @@ -359,6 +366,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: entity parent: GasCanister @@ -395,6 +403,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: Lock locked: true @@ -434,6 +443,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: entity parent: GasCanister @@ -471,6 +481,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: Lock locked: true