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;
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)
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))
{
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),