RCD Refactor (#34781)

* fixed prediction (hopefully), removed caching of prototype, sealed the class, removed any and count

* erroneus using statement

* removed unused timing, removed obsolete method of getting gridUid

* nuked mapgriddata

* code cleanup

* cleanup

* this has to be a string without me rewriting more code than i want to in this moment

* kill

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
gus
2025-04-17 18:34:38 -07:00
committed by GitHub
parent 944aa57907
commit 2c60d6b27f
6 changed files with 129 additions and 175 deletions

View File

@@ -6,6 +6,7 @@ using Content.Shared.RCD.Systems;
using Robust.Client.Placement;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
namespace Content.Client.RCD;
@@ -14,6 +15,7 @@ public sealed class RCDConstructionGhostSystem : EntitySystem
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly RCDSystem _rcdSystem = default!;
[Dependency] private readonly IPlacementManager _placementManager = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
private string _placementMode = typeof(AlignRCDConstruction).Name;
private Direction _placementDirection = default;
@@ -47,6 +49,7 @@ public sealed class RCDConstructionGhostSystem : EntitySystem
return;
}
var prototype = _protoManager.Index(rcd.ProtoId);
// Update the direction the RCD prototype based on the placer direction
if (_placementDirection != _placementManager.Direction)
@@ -56,9 +59,7 @@ public sealed class RCDConstructionGhostSystem : EntitySystem
}
// If the placer has not changed, exit
_rcdSystem.UpdateCachedPrototype(heldEntity.Value, rcd);
if (heldEntity == placerEntity && rcd.CachedPrototype.Prototype == placerProto)
if (heldEntity == placerEntity && prototype.Prototype == placerProto)
return;
// Create a new placer
@@ -66,9 +67,9 @@ public sealed class RCDConstructionGhostSystem : EntitySystem
{
MobUid = heldEntity.Value,
PlacementOption = _placementMode,
EntityType = rcd.CachedPrototype.Prototype,
EntityType = prototype.Prototype,
Range = (int) Math.Ceiling(SharedInteractionSystem.InteractionRange),
IsTile = (rcd.CachedPrototype.Mode == RcdMode.ConstructTile),
IsTile = (prototype.Mode == RcdMode.ConstructTile),
UseEditorContext = false,
};