Pipe visualizers (#3042)

* modifies pipe sprites to look not connected

* pipe connector sprites

* PipeConnectorVisualizer

* Remove pipe visualizer

* Revert "Remove pipe visualizer"

This reverts commit dc8da93f99f20aa55247c6a94d26c7a75a3d1782.

* PipeDirection can be set with the sprite updating correctly

* fixes meta files

* removes unused vent/scrubber directions

* OnConnectedDirectionsNeedsUpdating

* comments + OnConnectedDirectionsNeedsUpdating gets called

* fix connecteddirections bug

* Combines ConnectedDirections sent to visualizer

* fixes unconnected pipe sprites

* Adds PipeConnectorVisualizer to other piping entities

* code cleanup

* Fixed bug with ConnectedDirections not being set correctly

* diff fix

* rotation simplification

* Improves rsi serialization

* enable nullable

* wip

* visualizer cleanup

* nullable cleanup

Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
collinlunn
2021-02-22 19:18:30 -07:00
committed by GitHub
parent 6a79782fc0
commit 112f7d8346
26 changed files with 343 additions and 74 deletions

View File

@@ -13,15 +13,19 @@ namespace Content.Shared.GameObjects.Components.Atmos
[Serializable, NetSerializable]
public class PipeVisualState
{
public readonly PipeDirection PipeDirection;
public readonly PipeShape PipeShape;
public PipeVisualState(PipeDirection pipeDirection)
public readonly PipeDirection ConnectedDirections;
public PipeVisualState(PipeShape pipeShape, PipeDirection connectedDirections)
{
PipeDirection = pipeDirection;
PipeShape = pipeShape;
ConnectedDirections = connectedDirections;
}
}
[Flags]
[Serializable, NetSerializable]
public enum PipeDirection
{
None = 0,
@@ -63,6 +67,25 @@ namespace Content.Shared.GameObjects.Components.Atmos
Fourway
}
public static class PipeShapeHelpers
{
/// <summary>
/// Gets the direction of a shape when facing 0 degrees (the initial direction of entities).
/// </summary>
public static PipeDirection ToBaseDirection(this PipeShape shape)
{
return shape switch
{
PipeShape.Half => PipeDirection.East,
PipeShape.Straight => PipeDirection.Lateral,
PipeShape.Bend => PipeDirection.SEBend,
PipeShape.TJunction => PipeDirection.TEast,
PipeShape.Fourway => PipeDirection.Fourway,
_ => throw new ArgumentOutOfRangeException(nameof(shape), $"{shape} does not have an associated {nameof(PipeDirection)}."),
};
}
}
public static class PipeDirectionHelpers
{
public const int PipeDirections = 4;