diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs index fc6d186e67..82bbadbedc 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs @@ -16,6 +16,7 @@ using Robust.Server.Player; using Robust.Shared.Audio; using Robust.Shared.Configuration; using Robust.Shared.Map; +using Robust.Shared.Physics; using Robust.Shared.Player; using Robust.Shared.Random; @@ -256,8 +257,26 @@ public sealed partial class ShuttleSystem if (TryHyperspaceDock(shuttle, targetGrid.Value)) { + var xformQuery = GetEntityQuery(); + + if (TryComp(targetGrid.Value, out var targetXform)) + { + var (shuttlePos, shuttleRot) = xform.GetWorldPositionRotation(xformQuery); + var (targetPos, targetRot) = targetXform.GetWorldPositionRotation(xformQuery); + + var shuttleCOM = Robust.Shared.Physics.Transform.Mul(new Transform(shuttlePos, shuttleRot), + Comp(shuttle.Owner).LocalCenter); + var targetCOM = Robust.Shared.Physics.Transform.Mul(new Transform(targetPos, targetRot), + Comp(targetGrid.Value).LocalCenter); + + var mapDiff = shuttleCOM - targetCOM; + var targetRotation = targetRot; + var angle = mapDiff.ToWorldAngle(); + angle -= targetRotation; + _chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}"), ("direction", angle.GetDir())), playDefaultSound: false); + } + _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid.Value)} docked with stations"); - _chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}")), playDefaultSound: false); // TODO: Need filter extensions or something don't blame me. SoundSystem.Play("/Audio/Announcements/shuttle_dock.ogg", Filter.Broadcast()); } diff --git a/Resources/Locale/en-US/shuttles/emergency.ftl b/Resources/Locale/en-US/shuttles/emergency.ftl index b348f53a44..1792240811 100644 --- a/Resources/Locale/en-US/shuttles/emergency.ftl +++ b/Resources/Locale/en-US/shuttles/emergency.ftl @@ -13,7 +13,7 @@ emergency-shuttle-command-launch-desc = Early launches the emergency shuttle if # Emergency shuttle emergency-shuttle-left = The Emergency Shuttle has left the station. Estimate {$transitTime} seconds until the shuttle arrives at Centcomm. emergency-shuttle-launch-time = The emergency shuttle will launch in {$consoleAccumulator} seconds. -emergency-shuttle-docked = The Emergency Shuttle has docked with the station. It will leave in {$time} seconds. +emergency-shuttle-docked = The Emergency Shuttle has docked with the station on the {$direction} side. It will leave in {$time} seconds. emergency-shuttle-good-luck = The Emergency Shuttle is unable to find a station. Good luck. emergency-shuttle-nearby = The Emergency Shuttle is unable to find a valid docking port. It has warped in nearby.