From 4179821ffa127d8e103bc5d9493c6b5d90594c14 Mon Sep 17 00:00:00 2001 From: Mervill Date: Thu, 1 Aug 2024 22:42:02 -0700 Subject: [PATCH] Show the player a server message when they get booted from the arrivals shuttle (#30519) show the player a server message when they get booted from the arrivals shuttle --- .../Shuttles/Systems/ArrivalsSystem.cs | 18 +++++++++++++++--- .../Locale/en-US/game-ticking/game-ticker.ftl | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 47ccc3c3c4..0cbbc46a4f 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -1,6 +1,7 @@ using System.Linq; using System.Numerics; using Content.Server.Administration; +using Content.Server.Chat.Managers; using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Systems; using Content.Server.GameTicking; @@ -28,6 +29,7 @@ using Robust.Shared.Collections; using Robust.Shared.Configuration; using Robust.Shared.Console; using Robust.Shared.Map; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -46,6 +48,7 @@ public sealed class ArrivalsSystem : EntitySystem [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly IChatManager _chat = default!; [Dependency] private readonly BiomeSystem _biomes = default!; [Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly MapLoaderSystem _loader = default!; @@ -54,6 +57,7 @@ public sealed class ArrivalsSystem : EntitySystem [Dependency] private readonly ShuttleSystem _shuttles = default!; [Dependency] private readonly StationSpawningSystem _stationSpawning = default!; [Dependency] private readonly StationSystem _station = default!; + [Dependency] private readonly ActorSystem _actor = default!; private EntityQuery _pendingQuery; private EntityQuery _blacklistQuery; @@ -293,16 +297,20 @@ public sealed class ArrivalsSystem : EntitySystem private void DumpChildren(EntityUid uid, ref FTLStartedEvent args) { var toDump = new List>(); - DumpChildren(uid, ref args, toDump); + FindDumpChildren(uid, toDump); foreach (var (ent, xform) in toDump) { var rotation = xform.LocalRotation; _transform.SetCoordinates(ent, new EntityCoordinates(args.FromMapUid!.Value, Vector2.Transform(xform.LocalPosition, args.FTLFrom))); _transform.SetWorldRotation(ent, args.FromRotation + rotation); + if (_actor.TryGetSession(ent, out var session)) + { + _chat.DispatchServerMessage(session!, Loc.GetString("latejoin-arrivals-dumped-from-shuttle")); + } } } - private void DumpChildren(EntityUid uid, ref FTLStartedEvent args, List> toDump) + private void FindDumpChildren(EntityUid uid, List> toDump) { if (_pendingQuery.HasComponent(uid)) return; @@ -318,7 +326,7 @@ public sealed class ArrivalsSystem : EntitySystem var children = xform.ChildEnumerator; while (children.MoveNext(out var child)) { - DumpChildren(child, ref args, toDump); + FindDumpChildren(child, toDump); } } @@ -392,6 +400,10 @@ public sealed class ArrivalsSystem : EntitySystem { // Move the player to a random late-join spawnpoint. _transform.SetCoordinates(player, transform, _random.Pick(possiblePositions)); + if (_actor.TryGetSession(player, out var session)) + { + _chat.DispatchServerMessage(session!, Loc.GetString("latejoin-arrivals-teleport-to-spawn")); + } return true; } diff --git a/Resources/Locale/en-US/game-ticking/game-ticker.ftl b/Resources/Locale/en-US/game-ticking/game-ticker.ftl index 9527ecb57d..9c2d7bcf30 100644 --- a/Resources/Locale/en-US/game-ticking/game-ticker.ftl +++ b/Resources/Locale/en-US/game-ticking/game-ticker.ftl @@ -37,6 +37,8 @@ latejoin-arrival-announcement = {$character} ({$job}) has arrived at the station latejoin-arrival-sender = Station latejoin-arrivals-direction = A shuttle transferring you to your station will arrive shortly. latejoin-arrivals-direction-time = A shuttle transferring you to your station will arrive in {$time}. +latejoin-arrivals-dumped-from-shuttle = A mysterious force prevents you from leaving with the arrivals shuttle. +latejoin-arrivals-teleport-to-spawn = A mysterious force teleports you off the arrivals shuttle. Have a safe shift! preset-not-enough-ready-players = Can't start {$presetName}. Requires {$minimumPlayers} players but we have {$readyPlayersCount}. preset-no-one-ready = Can't start {$presetName}. No players are ready. \ No newline at end of file -- 2.52.0