using Content.Server.Administration.Managers;
using Content.Server.GameTicking.Events;
using Content.Server.Ghost;
+using Content.Server.Shuttles.Components;
using Content.Server.Spawners.Components;
using Content.Server.Speech.Components;
using Content.Server.Station.Components;
Loc.GetString("job-greet-station-name", ("stationName", metaData.EntityName)));
}
- // Arrivals is unable to do this during spawning as no actor is attached yet.
- // We also want this message last.
- if (!silent && lateJoin && _arrivals.Enabled)
- {
- var arrival = _arrivals.NextShuttleArrival();
- if (arrival == null)
- {
- _chatManager.DispatchServerMessage(player, Loc.GetString("latejoin-arrivals-direction"));
- }
- else
- {
- _chatManager.DispatchServerMessage(player,
- Loc.GetString("latejoin-arrivals-direction-time", ("time", $"{arrival:mm\\:ss}")));
- }
- }
-
// We raise this event directed to the mob, but also broadcast it so game rules can do something now.
PlayersJoinedRoundNormally++;
var aev = new PlayerSpawnCompleteEvent(mob,
player,
jobId,
lateJoin,
+ silent,
PlayersJoinedRoundNormally,
station,
character);
}
/// <summary>
- /// Makes a player join into the game and spawn on a staiton.
+ /// Makes a player join into the game and spawn on a station.
/// </summary>
/// <param name="player">The player joining</param>
/// <param name="station">The station they're spawning on</param>
public ICommonSession Player { get; }
public string? JobId { get; }
public bool LateJoin { get; }
+ public bool Silent { get; }
public EntityUid Station { get; }
public HumanoidCharacterProfile Profile { get; }
ICommonSession player,
string? jobId,
bool lateJoin,
+ bool silent,
int joinOrder,
EntityUid station,
HumanoidCharacterProfile profile)
Player = player;
JobId = jobId;
LateJoin = lateJoin;
+ Silent = silent;
Station = station;
Profile = profile;
JoinOrder = joinOrder;
SubscribeLocalEvent<ArrivalsShuttleComponent, FTLStartedEvent>(OnArrivalsFTL);
SubscribeLocalEvent<ArrivalsShuttleComponent, FTLCompletedEvent>(OnArrivalsDocked);
+ SubscribeLocalEvent<PlayerSpawnCompleteEvent>(SendDirections);
+
_pendingQuery = GetEntityQuery<PendingClockInComponent>();
_blacklistQuery = GetEntityQuery<ArrivalsBlacklistComponent>();
_mobQuery = GetEntityQuery<MobStateComponent>();
EnsureComp<GodmodeComponent>(ev.SpawnResult.Value);
}
+ private void SendDirections(PlayerSpawnCompleteEvent ev)
+ {
+ if (!Enabled || !ev.LateJoin || ev.Silent || !_pendingQuery.HasComp(ev.Mob))
+ return;
+
+ var arrival = NextShuttleArrival();
+
+ var message = arrival is not null
+ ? Loc.GetString("latejoin-arrivals-direction-time", ("time", $"{arrival:mm\\:ss}"))
+ : Loc.GetString("latejoin-arrivals-direction");
+
+ _chat.DispatchServerMessage(ev.Player, message);
+ }
+
private bool TryTeleportToMapSpawn(EntityUid player, EntityUid stationId, TransformComponent? transform = null)
{
if (!Resolve(player, ref transform))