]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix shuttle arrival visualizer (#35772)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 14 Apr 2025 14:34:18 +0000 (00:34 +1000)
committerGitHub <noreply@github.com>
Mon, 14 Apr 2025 14:34:18 +0000 (00:34 +1000)
* Fix shuttle arrival visualizer

It was at a fixed spot but if the target is rotating it wasn't handled.

* hew

* Fixes

Content.Server/Shuttles/DockingConfig.cs
Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs
Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs
Resources/Prototypes/Entities/Effects/shuttle.yml

index 58d2878514236e9e01ce3b1b38e59528e058361c..c4f707721927899ef53ab0a54e36cf449a7894e0 100644 (file)
@@ -24,5 +24,9 @@ public sealed class DockingConfig
     public Box2 Area;
 
     public EntityCoordinates Coordinates;
+
+    /// <summary>
+    /// Local angle of the docking grid relative to the target grid.
+    /// </summary>
     public Angle Angle;
 }
index 8435075a692f6c62dd6d72dcef54029e9cec9038..5e3029333e86d2651a917e1bddc446450b46015d 100644 (file)
@@ -79,7 +79,7 @@ public sealed partial class DockingSystem
             return false;
 
         shuttleDockedAABB = matty.TransformBox(shuttleAABB);
-        gridRotation = (targetGridRotation + offsetAngle).Reduced();
+        gridRotation = offsetAngle.Reduced();
         return true;
     }
 
@@ -125,7 +125,8 @@ public sealed partial class DockingSystem
     public DockingConfig? GetDockingConfigAt(EntityUid shuttleUid,
         EntityUid targetGrid,
         EntityCoordinates coordinates,
-        Angle angle)
+        Angle angle,
+        bool fallback = true)
     {
         var gridDocks = GetDocks(targetGrid);
         var shuttleDocks = GetDocks(shuttleUid);
@@ -140,6 +141,11 @@ public sealed partial class DockingSystem
             }
         }
 
+        if (fallback && configs.Count > 0)
+        {
+            return configs.First();
+        }
+
         return null;
     }
 
index b550db93ed630018e1425fd62c9399b89b06a1e2..cae6c443dda78b01166e3ee7b829103654f28133 100644 (file)
@@ -365,8 +365,6 @@ public sealed partial class ShuttleSystem
         _audio.SetGridAudio(audio);
         component.StartupStream = audio?.Entity;
 
-        // TODO: Play previs here for docking arrival.
-
         // Make sure the map is setup before we leave to avoid pop-in (e.g. parallax).
         EnsureFTLMap();
         return true;
@@ -450,7 +448,8 @@ public sealed partial class ShuttleSystem
 
         if (entity.Comp1.VisualizerProto != null)
         {
-            comp.VisualizerEntity = SpawnAtPosition(entity.Comp1.VisualizerProto, entity.Comp1.TargetCoordinates);
+            comp.VisualizerEntity = SpawnAttachedTo(entity.Comp1.VisualizerProto, entity.Comp1.TargetCoordinates);
+            DebugTools.Assert(Transform(comp.VisualizerEntity.Value).ParentUid == entity.Comp1.TargetCoordinates.EntityId);
             var visuals = Comp<FtlVisualizerComponent>(comp.VisualizerEntity.Value);
             visuals.Grid = entity.Owner;
             Dirty(comp.VisualizerEntity.Value, visuals);
@@ -756,7 +755,7 @@ public sealed partial class ShuttleSystem
         // Set position
         var mapCoordinates = _transform.ToMapCoordinates(config.Coordinates);
         var mapUid = _mapSystem.GetMap(mapCoordinates.MapId);
-        _transform.SetCoordinates(shuttle.Owner, shuttle.Comp, new EntityCoordinates(mapUid, mapCoordinates.Position), rotation: config.Angle);
+        _transform.SetCoordinates(shuttle.Owner, shuttle.Comp, new EntityCoordinates(mapUid, mapCoordinates.Position), rotation: config.Angle + _transform.GetWorldRotation(config.Coordinates.EntityId));
 
         // Connect everything
         foreach (var (dockAUid, dockBUid, dockA, dockB) in config.Docks)
index 72cc04cba11c820ec0a762e048ae50e24c805b1f..4dae76a48ac1127e7de31bfbe2a8d1cd3c216eee 100644 (file)
@@ -3,6 +3,9 @@
   categories: [ HideSpawnMenu ]
   description: Visualizer for shuttles arriving. You shouldn't see this!
   components:
+  - type: Transform
+    noRot: true
+    gridTraversal: false
   - type: FtlVisualizer
     sprite:
       sprite: /Textures/Effects/medi_holo.rsi