Disable Arrivals message for Cryosleep (#30888)

* Disable arrivals message for cryosleep late arrivals

* Provide silent to PlayerSpawnCompleteEvent

* Fix typo

* Move message to event and into arrivals system
This commit is contained in:
Thomas
2024-08-27 10:02:21 -05:00
committed by GitHub
parent 4b91f1f50b
commit d304123ef7
2 changed files with 22 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ using System.Numerics;
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;
@@ -274,28 +275,13 @@ namespace Content.Server.GameTicking
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);
@@ -314,7 +300,7 @@ namespace Content.Server.GameTicking
}
/// <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>
@@ -494,6 +480,7 @@ namespace Content.Server.GameTicking
public ICommonSession Player { get; }
public string? JobId { get; }
public bool LateJoin { get; }
public bool Silent { get; }
public EntityUid Station { get; }
public HumanoidCharacterProfile Profile { get; }
@@ -504,6 +491,7 @@ namespace Content.Server.GameTicking
ICommonSession player,
string? jobId,
bool lateJoin,
bool silent,
int joinOrder,
EntityUid station,
HumanoidCharacterProfile profile)
@@ -512,6 +500,7 @@ namespace Content.Server.GameTicking
Player = player;
JobId = jobId;
LateJoin = lateJoin;
Silent = silent;
Station = station;
Profile = profile;
JoinOrder = joinOrder;