Make pipes leak when destroyed (#20928)
This plugs a meta where atmos techs were fireaxing pipes to remove them without leaking their contents.
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Server.NodeContainer.Nodes;
|
|||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Construction.Components;
|
using Content.Shared.Construction.Components;
|
||||||
|
using Content.Shared.Destructible;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -21,6 +22,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
{
|
{
|
||||||
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, BeforeUnanchoredEvent>(OnBeforeUnanchored);
|
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, BeforeUnanchoredEvent>(OnBeforeUnanchored);
|
||||||
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
|
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
|
||||||
|
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, BreakageEventArgs>(OnBreak);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUnanchorAttempt(EntityUid uid, AtmosUnsafeUnanchorComponent component, UnanchorAttemptEvent args)
|
private void OnUnanchorAttempt(EntityUid uid, AtmosUnsafeUnanchorComponent component, UnanchorAttemptEvent args)
|
||||||
@@ -48,7 +50,24 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
|
|
||||||
private void OnBeforeUnanchored(EntityUid uid, AtmosUnsafeUnanchorComponent component, BeforeUnanchoredEvent args)
|
private void OnBeforeUnanchored(EntityUid uid, AtmosUnsafeUnanchorComponent component, BeforeUnanchoredEvent args)
|
||||||
{
|
{
|
||||||
if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
if (component.Enabled)
|
||||||
|
LeakGas(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBreak(EntityUid uid, AtmosUnsafeUnanchorComponent component, BreakageEventArgs args)
|
||||||
|
{
|
||||||
|
LeakGas(uid);
|
||||||
|
// Can't use DoActsBehavior["Destruction"] in the same trigger because that would prevent us
|
||||||
|
// from leaking. So we make up for this by queueing deletion here.
|
||||||
|
QueueDel(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Leak gas from the uid's NodeContainer into the tile atmosphere.
|
||||||
|
/// </summary>
|
||||||
|
public void LeakGas(EntityUid uid)
|
||||||
|
{
|
||||||
|
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_atmosphere.GetContainingMixture(uid, true, true) is not {} environment)
|
if (_atmosphere.GetContainingMixture(uid, true, true) is not {} environment)
|
||||||
|
|||||||
@@ -21,12 +21,27 @@
|
|||||||
- type: Rotatable
|
- type: Rotatable
|
||||||
- type: Destructible
|
- type: Destructible
|
||||||
thresholds:
|
thresholds:
|
||||||
- trigger:
|
- trigger: # for nukes
|
||||||
!type:DamageTrigger
|
!type:DamageTrigger
|
||||||
damage: 100
|
damage: 200
|
||||||
behaviors:
|
behaviors:
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: ["Destruction"]
|
acts: ["Destruction"]
|
||||||
|
- trigger: # regular damage trigger (replace with broken pipe)
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 100
|
||||||
|
behaviors:
|
||||||
|
- !type:PlaySoundBehavior
|
||||||
|
sound:
|
||||||
|
path: /Audio/Effects/metalbreak.ogg
|
||||||
|
- !type:SpawnEntitiesBehavior
|
||||||
|
spawn:
|
||||||
|
GasPipeBroken:
|
||||||
|
min: 1
|
||||||
|
max: 1
|
||||||
|
offset: 0
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: ["Breakage"]
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Piping/Atmospherics/pipe.rsi
|
sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
drawdepth: ThinPipe
|
drawdepth: ThinPipe
|
||||||
@@ -149,3 +164,28 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: GasPipe
|
graph: GasPipe
|
||||||
node: fourway
|
node: fourway
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: GasPipeBroken
|
||||||
|
parent: GasPipeBase
|
||||||
|
name: broken pipe
|
||||||
|
description: It used to hold gas.
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Structures/Piping/Atmospherics/pipe.rsi
|
||||||
|
drawdepth: ThinPipe
|
||||||
|
state: pipeBroken
|
||||||
|
layers:
|
||||||
|
- state: pipeBroken
|
||||||
|
map: [ "enum.PipeVisualLayers.Pipe" ]
|
||||||
|
- type: Construction
|
||||||
|
graph: GasPipe
|
||||||
|
node: broken
|
||||||
|
- type: Destructible
|
||||||
|
thresholds: # override parent to avoid recursive destruction
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 100
|
||||||
|
behaviors:
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: ["Destruction"]
|
||||||
|
|||||||
@@ -113,3 +113,19 @@
|
|||||||
steps:
|
steps:
|
||||||
- tool: Welding
|
- tool: Welding
|
||||||
doAfter: 1
|
doAfter: 1
|
||||||
|
|
||||||
|
- node: broken
|
||||||
|
entity: GasPipeBroken
|
||||||
|
edges:
|
||||||
|
- to: start
|
||||||
|
conditions:
|
||||||
|
- !type:EntityAnchored
|
||||||
|
anchored: false
|
||||||
|
completed:
|
||||||
|
- !type:SpawnPrototype
|
||||||
|
prototype: SheetSteel1
|
||||||
|
amount: 1
|
||||||
|
- !type:DeleteEntity
|
||||||
|
steps:
|
||||||
|
- tool: Welding
|
||||||
|
doAfter: 1
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
"license":"CC-BY-SA-3.0",
|
"license":"CC-BY-SA-3.0",
|
||||||
"copyright":"pipeTrinaryConnectors made by Menshin for SS14 based on pipeTJunction, the rest is taken from https://github.com/tgstation/tgstation at commit 57cd1d59ca019dd0e7811ac451f295f818e573da",
|
"copyright":"pipeTrinaryConnectors made by Menshin for SS14 based on pipeTJunction, the rest is taken from https://github.com/tgstation/tgstation at commit 57cd1d59ca019dd0e7811ac451f295f818e573da",
|
||||||
"states":[
|
"states":[
|
||||||
|
{
|
||||||
|
"name":"pipeBroken",
|
||||||
|
"directions":1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name":"pipeTJunction",
|
"name":"pipeTJunction",
|
||||||
"directions":4
|
"directions":4
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 643 B |
Reference in New Issue
Block a user