Skip to content

Commit

Permalink
Disposal Pipe Crafting (#6188)
Browse files Browse the repository at this point in the history
  • Loading branch information
DubiousDoggo authored Jan 22, 2022
1 parent 7eee6c6 commit 90a5c6e
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 33 deletions.
4 changes: 0 additions & 4 deletions Content.Client/Disposal/Visualizers/DisposalVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public class DisposalVisualizer : AppearanceVisualizer
[DataField("state_anchored")]
private string? _stateAnchored;

[DataField("state_broken")]
private string? _stateBroken;

private void ChangeState(AppearanceComponent appearance)
{
var entities = IoCManager.Resolve<IEntityManager>();
Expand All @@ -38,7 +35,6 @@ private void ChangeState(AppearanceComponent appearance)
{
DisposalTubeVisualState.Free => _stateFree,
DisposalTubeVisualState.Anchored => _stateAnchored,
DisposalTubeVisualState.Broken => _stateBroken,
_ => throw new ArgumentOutOfRangeException()
};

Expand Down
18 changes: 4 additions & 14 deletions Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public abstract class DisposalTubeComponent : Component, IDisposalTubeComponent,
public TimeSpan LastClang;

private bool _connected;
private bool _broken;
[DataField("clangSound")] public SoundSpecifier ClangSound = new SoundPathSpecifier("/Audio/Effects/clang.ogg");

/// <summary>
Expand All @@ -51,7 +50,7 @@ public abstract class DisposalTubeComponent : Component, IDisposalTubeComponent,
// TODO: Make disposal pipes extend the grid
private void Connect()
{
if (_connected || _broken)
if (_connected)
{
return;
}
Expand All @@ -66,11 +65,6 @@ public bool CanConnect(Direction direction, IDisposalTubeComponent with)
return false;
}

if (_broken)
{
return false;
}

if (!ConnectableDirections().Contains(direction))
{
return false;
Expand Down Expand Up @@ -113,11 +107,9 @@ private void UpdateVisualState()
return;
}

var state = _broken
? DisposalTubeVisualState.Broken
: Anchored
? DisposalTubeVisualState.Anchored
: DisposalTubeVisualState.Free;
var state = Anchored
? DisposalTubeVisualState.Anchored
: DisposalTubeVisualState.Free;

appearance.SetData(DisposalTubeVisuals.VisualState, state);
}
Expand Down Expand Up @@ -182,9 +174,7 @@ protected override void OnRemove()

void IBreakAct.OnBreak(BreakageEventArgs eventArgs)
{
_broken = true; // TODO: Repair
Disconnect();
UpdateVisualState();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ public enum DisposalTubeVisualState
{
Free = 0,
Anchored,
Broken,
}
}
57 changes: 48 additions & 9 deletions Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
behaviors:
- !type:DoActsBehavior
acts: ["Breakage"]
- !type:ChangeConstructionNodeBehavior
node: broken
- type: Rotatable
- type: Pullable

Expand All @@ -46,6 +48,31 @@

# Pipes

- type: entity
id: DisposalPipeBroken
parent: DisposalPipeBase
name: broken disposal pipe
description: A BBP (big broken pipe)
components:
- type: Sprite
drawdepth: ThickPipe
sprite: Structures/Piping/disposal.rsi
state: pipe-b
- type: Appearance
visuals:
- type: TrayScannerSubFloorVisualizer
- type: SubFloorShowLayerVisualizer
- type: Physics
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.25,-0.5,0.25,0.5"
layer: [ Underplating ]
- type: Construction
graph: DisposalPipe
node: broken

- type: entity
id: DisposalPipe
parent: DisposalPipeBase
Expand All @@ -64,14 +91,16 @@
- type: DisposalVisualizer
state_free: conpipe-s
state_anchored: pipe-s
state_broken: pipe-b
- type: Physics
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.25,-0.5,0.25,0.5"
layer: [ Underplating ]
- type: Construction
graph: DisposalPipe
node: pipe

- type: entity
id: DisposalTagger
Expand All @@ -91,7 +120,6 @@
- type: DisposalVisualizer
state_free: conpipe-tagger
state_anchored: pipe-tagger
state_broken: pipe-b
- type: UserInterface
interfaces:
- key: enum.DisposalTaggerUiKey.Key
Expand All @@ -103,6 +131,9 @@
!type:PhysShapeAabb
bounds: "-0.25,-0.5,0.25,0.5"
layer: [ Underplating ]
- type: Construction
graph: DisposalPipe
node: tagger

- type: entity
id: DisposalTrunk
Expand All @@ -122,14 +153,16 @@
- type: DisposalVisualizer
state_free: conpipe-t
state_anchored: pipe-t
state_broken: pipe-b
- type: Physics
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.25,-0.5,0.25,0.4"
layer: [ Underplating ]
- type: Construction
graph: DisposalPipe
node: trunk

- type: entity
id: DisposalRouter
Expand All @@ -153,7 +186,6 @@
- type: DisposalVisualizer
state_free: conpipe-j1s
state_anchored: pipe-j1s
state_broken: pipe-b
- type: Flippable
mirrorEntity: DisposalRouterFlipped
- type: UserInterface
Expand All @@ -167,6 +199,9 @@
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.25,0.5"
layer: [ Underplating ]
- type: Construction
graph: DisposalPipe
node: router

- type: entity
id: DisposalRouterFlipped
Expand All @@ -189,7 +224,6 @@
- type: DisposalVisualizer
state_free: conpipe-j2s
state_anchored: pipe-j2s
state_broken: pipe-b
- type: Flippable
mirrorEntity: DisposalRouter
- type: Physics
Expand Down Expand Up @@ -222,7 +256,6 @@
- type: DisposalVisualizer
state_free: conpipe-j1
state_anchored: pipe-j1
state_broken: pipe-b
- type: Flippable
mirrorEntity: DisposalJunctionFlipped
- type: Physics
Expand All @@ -232,6 +265,9 @@
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.25,0.5"
layer: [ Underplating ]
- type: Construction
graph: DisposalPipe
node: junction

- type: entity
id: DisposalJunctionFlipped
Expand All @@ -254,7 +290,6 @@
- type: DisposalVisualizer
state_free: conpipe-j2
state_anchored: pipe-j2
state_broken: pipe-b
- type: Flippable
mirrorEntity: DisposalJunction
- type: Physics
Expand Down Expand Up @@ -287,14 +322,16 @@
- type: DisposalVisualizer
state_free: conpipe-y
state_anchored: pipe-y
state_broken: pipe-b
- type: Physics
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.5,0.25"
layer: [ Underplating ]
- type: Construction
graph: DisposalPipe
node: yJunction

- type: entity
id: DisposalBend
Expand All @@ -314,11 +351,13 @@
- type: DisposalVisualizer
state_free: conpipe-c
state_anchored: pipe-c
state_broken: pipe-b
- type: Physics
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.25,0.25"
layer: [ Underplating ]
- type: Construction
graph: DisposalPipe
node: bend
Loading

0 comments on commit 90a5c6e

Please sign in to comment.