From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Mon, 14 Apr 2025 14:34:18 +0000 (+1000)
Subject: Fix shuttle arrival visualizer (#35772)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=dfa5ccf625d9c2e582792773c1cf20b98694b511;p=space-station-14.git
Fix shuttle arrival visualizer (#35772)
* Fix shuttle arrival visualizer
It was at a fixed spot but if the target is rotating it wasn't handled.
* hew
* Fixes
---
diff --git a/Content.Server/Shuttles/DockingConfig.cs b/Content.Server/Shuttles/DockingConfig.cs
index 58d2878514..c4f7077219 100644
--- a/Content.Server/Shuttles/DockingConfig.cs
+++ b/Content.Server/Shuttles/DockingConfig.cs
@@ -24,5 +24,9 @@ public sealed class DockingConfig
public Box2 Area;
public EntityCoordinates Coordinates;
+
+ ///
+ /// Local angle of the docking grid relative to the target grid.
+ ///
public Angle Angle;
}
diff --git a/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs b/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs
index 8435075a69..5e3029333e 100644
--- a/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs
+++ b/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs
@@ -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;
}
diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs
index b550db93ed..cae6c443dd 100644
--- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs
+++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs
@@ -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(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)
diff --git a/Resources/Prototypes/Entities/Effects/shuttle.yml b/Resources/Prototypes/Entities/Effects/shuttle.yml
index 72cc04cba1..4dae76a48a 100644
--- a/Resources/Prototypes/Entities/Effects/shuttle.yml
+++ b/Resources/Prototypes/Entities/Effects/shuttle.yml
@@ -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