diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index b2807b1ea8..04a9939421 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Atmos.Components; using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.Piping.Components; using Content.Server.Atmos.Piping.Unary.Components; +using Content.Server.Destructible; using Content.Server.Hands.Components; using Content.Server.NodeContainer; using Content.Server.NodeContainer.NodeGroups; @@ -44,6 +45,22 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems SubscribeLocalEvent(OnHoldingTankEjectMessage); SubscribeLocalEvent(OnCanisterChangeReleasePressure); SubscribeLocalEvent(OnCanisterChangeReleaseValve); + + } + + /// + /// Completely dumps the content of the canister into the world. + /// + public void PurgeContents(EntityUid uid, GasCanisterComponent? canister = null, ITransformComponent? transform = null) + { + if (!Resolve(uid, ref canister, ref transform)) return; + + var environment = _atmosphereSystem.GetTileMixture(transform.Coordinates, true); + + if (environment is not null) + _atmosphereSystem.Merge(environment, canister.Air); + + canister.Air.Clear(); } private void OnCanisterStartup(EntityUid uid, GasCanisterComponent canister, ComponentStartup args) diff --git a/Content.Server/Destructible/Thresholds/Behaviors/DumpCanisterBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/DumpCanisterBehavior.cs new file mode 100644 index 0000000000..bddfaee046 --- /dev/null +++ b/Content.Server/Destructible/Thresholds/Behaviors/DumpCanisterBehavior.cs @@ -0,0 +1,20 @@ +using System; +using Content.Server.Atmos.Piping.Unary.Components; +using Content.Server.Atmos.Piping.Unary.EntitySystems; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Server.Destructible.Thresholds.Behaviors +{ + [Serializable] + [DataDefinition] + public class DumpCanisterBehavior: IThresholdBehavior + { + public void Execute(IEntity owner, DestructibleSystem system) + { + var gasCanisterSystem = EntitySystem.Get(); + + gasCanisterSystem.PurgeContents(owner.Uid); + } + } +} diff --git a/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml b/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml index cc68a0e4b2..f9760b1005 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml @@ -267,6 +267,7 @@ max: 1 - !type:DoActsBehavior acts: [ "Destruction" ] + - !type:DumpCanisterBehavior - type: entity parent: GasCanister