Shuttle announces its docking direction (#9564)
* Shuttle announces its docking direction * Consider COM juusssttt in case
This commit is contained in:
parent
c68fcb7f4c
commit
18e7d80970
|
|
@ -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<TransformComponent>();
|
||||
|
||||
if (TryComp<TransformComponent>(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<PhysicsComponent>(shuttle.Owner).LocalCenter);
|
||||
var targetCOM = Robust.Shared.Physics.Transform.Mul(new Transform(targetPos, targetRot),
|
||||
Comp<PhysicsComponent>(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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue