From af05313f37e45103fcaa51f21e654f9a076a4819 Mon Sep 17 00:00:00 2001
From: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Date: Sat, 11 Oct 2025 01:59:56 +0200
Subject: [PATCH] fix NetEntity datafield in JointVisualsComponent (#39987)
fix netentity datafield
---
Content.Client/Physics/JointVisualsOverlay.cs | 6 +++---
.../Physics/JointVisualsComponent.cs | 19 ++++++++++++++-----
.../Weapons/Misc/SharedGrapplingGunSystem.cs | 2 +-
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/Content.Client/Physics/JointVisualsOverlay.cs b/Content.Client/Physics/JointVisualsOverlay.cs
index 9cc2831d21..ddac71f4ea 100644
--- a/Content.Client/Physics/JointVisualsOverlay.cs
+++ b/Content.Client/Physics/JointVisualsOverlay.cs
@@ -36,7 +36,7 @@ public sealed class JointVisualsOverlay : Overlay
if (xform.MapID != args.MapId)
continue;
- var other = _entManager.GetEntity(visuals.Target);
+ var other = visuals.Target;
if (!xformQuery.TryGetComponent(other, out var otherXform))
continue;
@@ -45,7 +45,7 @@ public sealed class JointVisualsOverlay : Overlay
continue;
var texture = spriteSystem.Frame0(visuals.Sprite);
- var width = texture.Width / (float) EyeManager.PixelsPerMeter;
+ var width = texture.Width / (float)EyeManager.PixelsPerMeter;
var coordsA = xform.Coordinates;
var coordsB = otherXform.Coordinates;
@@ -58,7 +58,7 @@ public sealed class JointVisualsOverlay : Overlay
var posA = xformSystem.ToMapCoordinates(coordsA).Position;
var posB = xformSystem.ToMapCoordinates(coordsB).Position;
- var diff = (posB - posA);
+ var diff = posB - posA;
var length = diff.Length();
var midPoint = diff / 2f + posA;
diff --git a/Content.Shared/Physics/JointVisualsComponent.cs b/Content.Shared/Physics/JointVisualsComponent.cs
index 37a9cdc3b1..5179c31a86 100644
--- a/Content.Shared/Physics/JointVisualsComponent.cs
+++ b/Content.Shared/Physics/JointVisualsComponent.cs
@@ -10,21 +10,30 @@ namespace Content.Shared.Physics;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class JointVisualsComponent : Component
{
- [ViewVariables(VVAccess.ReadWrite), DataField("sprite", required: true), AutoNetworkedField]
+ ///
+ /// The sprite to use for the line.
+ ///
+ [DataField(required: true), AutoNetworkedField]
public SpriteSpecifier Sprite = default!;
- [ViewVariables(VVAccess.ReadWrite), DataField("target"), AutoNetworkedField]
- public NetEntity? Target;
+ ///
+ /// The line is drawn between this target and the entity owning the component.
+ ///
+ ///
+ /// TODO: WeakEntityReference.
+ ///
+ [DataField, AutoNetworkedField]
+ public EntityUid? Target;
///
/// Offset from Body A.
///
- [ViewVariables(VVAccess.ReadWrite), DataField("offsetA"), AutoNetworkedField]
+ [DataField, AutoNetworkedField]
public Vector2 OffsetA;
///
/// Offset from Body B.
///
- [ViewVariables(VVAccess.ReadWrite), DataField("offsetB"), AutoNetworkedField]
+ [DataField, AutoNetworkedField]
public Vector2 OffsetB;
}
diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs
index 1a0a31d4b1..a3c5a322ee 100644
--- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs
+++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs
@@ -66,7 +66,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
var visuals = EnsureComp(shotUid.Value);
visuals.Sprite = component.RopeSprite;
visuals.OffsetA = new Vector2(0f, 0.5f);
- visuals.Target = GetNetEntity(uid);
+ visuals.Target = uid;
Dirty(shotUid.Value, visuals);
}