From aca846c6add9db7b8d495f2d0547758cd0d0c55a Mon Sep 17 00:00:00 2001 From: Kyle Tyo <36606155+VerinSenpai@users.noreply.github.com> Date: Tue, 18 Feb 2025 07:34:15 -0500 Subject: [PATCH] Fix build ghosts not being placeable on a new round. (#35097) --- .../Construction/ConstructionGhostComponent.cs | 1 + Content.Client/Construction/ConstructionSystem.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Content.Client/Construction/ConstructionGhostComponent.cs b/Content.Client/Construction/ConstructionGhostComponent.cs index 8f4fe3867e..45d1d618fc 100644 --- a/Content.Client/Construction/ConstructionGhostComponent.cs +++ b/Content.Client/Construction/ConstructionGhostComponent.cs @@ -7,6 +7,7 @@ namespace Content.Client.Construction [RegisterComponent] public sealed partial class ConstructionGhostComponent : Component { + public int GhostId { get; set; } [ViewVariables] public ConstructionPrototype? Prototype { get; set; } } } diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index f909b23423..17d6b05388 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -55,6 +55,12 @@ namespace Content.Client.Construction .Register(); SubscribeLocalEvent(HandleConstructionGhostExamined); + SubscribeLocalEvent(HandleGhostComponentShutdown); + } + + private void HandleGhostComponentShutdown(EntityUid uid, ConstructionGhostComponent component, ComponentShutdown args) + { + ClearGhost(component.GhostId); } private void OnConstructionGuideReceived(ResponseConstructionGuide ev) @@ -205,8 +211,9 @@ namespace Content.Client.Construction ghost = EntityManager.SpawnEntity("constructionghost", loc); var comp = EntityManager.GetComponent(ghost.Value); comp.Prototype = prototype; + comp.GhostId = ghost.GetHashCode(); EntityManager.GetComponent(ghost.Value).LocalRotation = dir.ToAngle(); - _ghosts.Add(ghost.GetHashCode(), ghost.Value); + _ghosts.Add(comp.GhostId, ghost.Value); var sprite = EntityManager.GetComponent(ghost.Value); sprite.Color = new Color(48, 255, 48, 128); -- 2.51.2