]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix RCD ghosts not disappearing when changing hand to empty (#38622)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Fri, 27 Jun 2025 16:39:49 +0000 (18:39 +0200)
committerGitHub <noreply@github.com>
Fri, 27 Jun 2025 16:39:49 +0000 (19:39 +0300)
Content.Client/RCD/RCDConstructionGhostSystem.cs

index 8ec980268b9d4e421f195c4e988a67fc02df74ff..fcbe3aece7051c96aa1a18991b39edc3f6aa49fe 100644 (file)
@@ -1,9 +1,7 @@
 using Content.Client.Hands.Systems;
-using Content.Shared.Hands.Components;
 using Content.Shared.Interaction;
 using Content.Shared.RCD;
 using Content.Shared.RCD.Components;
-using Content.Shared.RCD.Systems;
 using Robust.Client.Placement;
 using Robust.Client.Player;
 using Robust.Shared.Enums;
@@ -11,14 +9,18 @@ using Robust.Shared.Prototypes;
 
 namespace Content.Client.RCD;
 
+/// <summary>
+/// System for handling structure ghost placement in places where RCD can create objects.
+/// </summary>
 public sealed class RCDConstructionGhostSystem : EntitySystem
 {
+    private const string PlacementMode = nameof(AlignRCDConstruction);
+
     [Dependency] private readonly IPlayerManager _playerManager = default!;
     [Dependency] private readonly IPlacementManager _placementManager = default!;
     [Dependency] private readonly IPrototypeManager _protoManager = default!;
     [Dependency] private readonly HandsSystem _hands = default!;
-
-    private string _placementMode = typeof(AlignRCDConstruction).Name;
+    
     private Direction _placementDirection = default;
 
     public override void Update(float frameTime)
@@ -38,8 +40,7 @@ public sealed class RCDConstructionGhostSystem : EntitySystem
         if (_playerManager.LocalSession?.AttachedEntity is not { } player)
             return;
 
-        if (!_hands.TryGetActiveItem(player, out var heldEntity))
-            return;
+        var heldEntity = _hands.GetActiveItem(player);
 
         if (!TryComp<RCDComponent>(heldEntity, out var rcd))
         {
@@ -66,7 +67,7 @@ public sealed class RCDConstructionGhostSystem : EntitySystem
         var newObjInfo = new PlacementInformation
         {
             MobUid = heldEntity.Value,
-            PlacementOption = _placementMode,
+            PlacementOption = PlacementMode,
             EntityType = prototype.Prototype,
             Range = (int) Math.Ceiling(SharedInteractionSystem.InteractionRange),
             IsTile = (prototype.Mode == RcdMode.ConstructTile),