Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Prevent stacking pipes (#28308)" #2365

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

123 changes: 0 additions & 123 deletions Content.Server/Atmos/EntitySystems/PipeRestrictOverlapSystem.cs

This file was deleted.

41 changes: 18 additions & 23 deletions Content.Server/Construction/ConstructionSystem.Initial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using Content.Shared.Storage;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Timing;

Expand Down Expand Up @@ -94,14 +93,7 @@ private IEnumerable<EntityUid> EnumerateNearby(EntityUid user)
}

// LEGACY CODE. See warning at the top of the file!
private async Task<EntityUid?> Construct(
EntityUid user,
string materialContainer,
ConstructionGraphPrototype graph,
ConstructionGraphEdge edge,
ConstructionGraphNode targetNode,
EntityCoordinates coords,
Angle angle = default)
private async Task<EntityUid?> Construct(EntityUid user, string materialContainer, ConstructionGraphPrototype graph, ConstructionGraphEdge edge, ConstructionGraphNode targetNode)
{
// We need a place to hold our construction items!
var container = _container.EnsureContainer<Container>(user, materialContainer, out var existed);
Expand Down Expand Up @@ -271,7 +263,11 @@ void ShutdownContainers()
}

var newEntityProto = graph.Nodes[edge.Target].Entity.GetId(null, user, new(EntityManager));
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Разметка мердж конфликта 🙂

var newEntity = EntityManager.SpawnAttachedTo(newEntityProto, coords, rotation: angle);
=======
var newEntity = EntityManager.SpawnEntity(newEntityProto, EntityManager.GetComponent<TransformComponent>(user).Coordinates);
>>>>>>> parent of 44b93e68ee (Prevent stacking pipes (#28308))

if (!TryComp(newEntity, out ConstructionComponent? construction))
{
Expand Down Expand Up @@ -386,13 +382,7 @@ public async Task<bool> TryStartItemConstruction(string prototype, EntityUid use
}
}

if (await Construct(
user,
"item_construction",
constructionGraph,
edge,
targetNode,
Transform(user).Coordinates) is not { Valid: true } item)
if (await Construct(user, "item_construction", constructionGraph, edge, targetNode) is not { Valid: true } item)
return false;

// Just in case this is a stack, attempt to merge it. If it isn't a stack, this will just normally pick up
Expand Down Expand Up @@ -527,18 +517,23 @@ void Cleanup()
return;
}

if (await Construct(user,
(ev.Ack + constructionPrototype.GetHashCode()).ToString(),
constructionGraph,
edge,
targetNode,
GetCoordinates(ev.Location),
constructionPrototype.CanRotate ? ev.Angle : Angle.Zero) is not {Valid: true} structure)
if (await Construct(user, (ev.Ack + constructionPrototype.GetHashCode()).ToString(), constructionGraph,
edge, targetNode) is not {Valid: true} structure)
{
Cleanup();
return;
}

// We do this to be able to move the construction to its proper position in case it's anchored...
// Oh wow transform anchoring is amazing wow I love it!!!!
// ikr
var xform = Transform(structure);
var wasAnchored = xform.Anchored;
xform.Anchored = false;
xform.Coordinates = GetCoordinates(ev.Location);
xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero;
xform.Anchored = wasAnchored;

RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack, GetNetEntity(structure)));
_adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(user):player} has turned a {ev.PrototypeName} construction ghost into {ToPrettyString(structure)} at {Transform(structure).Coordinates}");
Cleanup();
Expand Down
16 changes: 8 additions & 8 deletions Content.Server/NodeContainer/Nodes/PipeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public partial class PipeNode : Node, IGasMixtureHolder, IRotatableNode
/// The directions in which this pipe can connect to other pipes around it.
/// </summary>
[DataField("pipeDirection")]
public PipeDirection OriginalPipeDirection;
private PipeDirection _originalPipeDirection;

/// <summary>
/// The *current* pipe directions (accounting for rotation)
Expand Down Expand Up @@ -110,26 +110,26 @@ public override void Initialize(EntityUid owner, IEntityManager entMan)
return;

var xform = entMan.GetComponent<TransformComponent>(owner);
CurrentPipeDirection = OriginalPipeDirection.RotatePipeDirection(xform.LocalRotation);
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(xform.LocalRotation);
}

bool IRotatableNode.RotateNode(in MoveEvent ev)
{
if (OriginalPipeDirection == PipeDirection.Fourway)
if (_originalPipeDirection == PipeDirection.Fourway)
return false;

// update valid pipe direction
if (!RotationsEnabled)
{
if (CurrentPipeDirection == OriginalPipeDirection)
if (CurrentPipeDirection == _originalPipeDirection)
return false;

CurrentPipeDirection = OriginalPipeDirection;
CurrentPipeDirection = _originalPipeDirection;
return true;
}

var oldDirection = CurrentPipeDirection;
CurrentPipeDirection = OriginalPipeDirection.RotatePipeDirection(ev.NewRotation);
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(ev.NewRotation);
return oldDirection != CurrentPipeDirection;
}

Expand All @@ -142,12 +142,12 @@ public override void OnAnchorStateChanged(IEntityManager entityManager, bool anc

if (!RotationsEnabled)
{
CurrentPipeDirection = OriginalPipeDirection;
CurrentPipeDirection = _originalPipeDirection;
return;
}

var xform = entityManager.GetComponent<TransformComponent>(Owner);
CurrentPipeDirection = OriginalPipeDirection.RotatePipeDirection(xform.LocalRotation);
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(xform.LocalRotation);
}

public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
construction-step-condition-no-unstackable-in-tile = You cannot make a stack of similar devices.
pipe-restrict-overlap-popup-blocked = { CAPITALIZE(THE($pipe))} doesn't fit over the other pipes!
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@
- type: PipeColorVisuals
- type: Rotatable
- type: GasRecycler
- type: PipeRestrictOverlap
- type: NodeContainer
nodes:
inlet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
- type: Appearance
- type: PipeColorVisuals
- type: NodeContainer
- type: PipeRestrictOverlap
- type: AtmosUnsafeUnanchor
- type: AtmosPipeColor
- type: Tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@
key: enum.ThermomachineUiKey.Key
- type: WiresPanel
- type: WiresVisuals
- type: PipeRestrictOverlap
- type: NodeContainer
nodes:
pipe:
Expand Down Expand Up @@ -382,7 +381,6 @@
- type: GasCondenser
- type: AtmosPipeColor
- type: AtmosDevice
- type: PipeRestrictOverlap
- type: ApcPowerReceiver
powerLoad: 10000
- type: Machine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@
nodeGroupID: Teg

- type: AtmosUnsafeUnanchor
- type: PipeRestrictOverlap
- type: TegCirculator
- type: StealTarget
stealGroup: Teg
Expand Down
Loading