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