diff --git a/Content.Client/GameObjects/EntitySystems/ConstructionSystem.cs b/Content.Client/GameObjects/EntitySystems/ConstructionSystem.cs index 57537e8a5b..700393b9c5 100644 --- a/Content.Client/GameObjects/EntitySystems/ConstructionSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ConstructionSystem.cs @@ -153,6 +153,11 @@ namespace Content.Client.GameObjects.EntitySystems /// public void SpawnGhost(ConstructionPrototype prototype, GridCoordinates loc, Direction dir) { + if (GhostPresent(loc)) + { + return; + } + var ghost = _entityManager.SpawnEntity("constructionghost", loc); var comp = ghost.GetComponent(); comp.Prototype = prototype; @@ -167,6 +172,22 @@ namespace Content.Client.GameObjects.EntitySystems sprite.LayerSetVisible(0, true); } + /// + /// Checks if any construction ghosts are present at the given position + /// + private bool GhostPresent(GridCoordinates loc) + { + foreach (KeyValuePair ghost in _ghosts) + { + if (ghost.Value.Owner.Transform.GridPosition.Equals(loc)) + { + return true; + } + } + + return false; + } + private void TryStartConstruction(int ghostId) { var ghost = _ghosts[ghostId];