]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix NetEntity datafield in JointVisualsComponent (#39987)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Fri, 10 Oct 2025 23:59:56 +0000 (01:59 +0200)
committerGitHub <noreply@github.com>
Fri, 10 Oct 2025 23:59:56 +0000 (23:59 +0000)
fix netentity datafield

Content.Client/Physics/JointVisualsOverlay.cs
Content.Shared/Physics/JointVisualsComponent.cs
Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs

index 9cc2831d2128ac28eee8baece08819a7e51b1afa..ddac71f4ea1723253aa969e4b056d420310aca38 100644 (file)
@@ -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;
index 37a9cdc3b1727c40bd24d53b64db120c71e0654a..5179c31a86b6e3b6aa4495b8e0e8ad7bbbf2d787 100644 (file)
@@ -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]
+    /// <summary>
+    /// The sprite to use for the line.
+    /// </summary>
+    [DataField(required: true), AutoNetworkedField]
     public SpriteSpecifier Sprite = default!;
 
-    [ViewVariables(VVAccess.ReadWrite), DataField("target"), AutoNetworkedField]
-    public NetEntity? Target;
+    /// <summary>
+    /// The line is drawn between this target and the entity owning the component.
+    /// </summary>
+    /// <summary>
+    /// TODO: WeakEntityReference.
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public EntityUid? Target;
 
     /// <summary>
     /// Offset from Body A.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("offsetA"), AutoNetworkedField]
+    [DataField, AutoNetworkedField]
     public Vector2 OffsetA;
 
     /// <summary>
     /// Offset from Body B.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("offsetB"), AutoNetworkedField]
+    [DataField, AutoNetworkedField]
     public Vector2 OffsetB;
 }
index 1a0a31d4b1ee9d6b02ee594d6d1c3d6c72e725cd..a3c5a322eee5e0b2e87b3fc0a8191cb9122efa4a 100644 (file)
@@ -66,7 +66,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
             var visuals = EnsureComp<JointVisualsComponent>(shotUid.Value);
             visuals.Sprite = component.RopeSprite;
             visuals.OffsetA = new Vector2(0f, 0.5f);
-            visuals.Target = GetNetEntity(uid);
+            visuals.Target = uid;
             Dirty(shotUid.Value, visuals);
         }