]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix build ghosts not being placeable on a new round. (#35097)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Tue, 18 Feb 2025 12:34:15 +0000 (07:34 -0500)
committerGitHub <noreply@github.com>
Tue, 18 Feb 2025 12:34:15 +0000 (23:34 +1100)
Content.Client/Construction/ConstructionGhostComponent.cs
Content.Client/Construction/ConstructionSystem.cs

index 8f4fe3867e87283efc166565d050bbcd7cce771a..45d1d618fc501294928d3fbab208f78b2e48b8d6 100644 (file)
@@ -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; }
     }
 }
index f909b23423db1cfdb02719d331e93b2394873696..17d6b0538838da4fc4f2703e8f1f74527f7d8a6c 100644 (file)
@@ -55,6 +55,12 @@ namespace Content.Client.Construction
                 .Register<ConstructionSystem>();
 
             SubscribeLocalEvent<ConstructionGhostComponent, ExaminedEvent>(HandleConstructionGhostExamined);
+            SubscribeLocalEvent<ConstructionGhostComponent, ComponentShutdown>(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<ConstructionGhostComponent>(ghost.Value);
             comp.Prototype = prototype;
+            comp.GhostId = ghost.GetHashCode();
             EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
-            _ghosts.Add(ghost.GetHashCode(), ghost.Value);
+            _ghosts.Add(comp.GhostId, ghost.Value);
             var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
             sprite.Color = new Color(48, 255, 48, 128);