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:
@@ -4,6 +4,7 @@ using System.Numerics;
|
|||||||
using Content.Server.Administration.Managers;
|
using Content.Server.Administration.Managers;
|
||||||
using Content.Server.GameTicking.Events;
|
using Content.Server.GameTicking.Events;
|
||||||
using Content.Server.Ghost;
|
using Content.Server.Ghost;
|
||||||
|
using Content.Server.Shuttles.Components;
|
||||||
using Content.Server.Spawners.Components;
|
using Content.Server.Spawners.Components;
|
||||||
using Content.Server.Speech.Components;
|
using Content.Server.Speech.Components;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
@@ -274,28 +275,13 @@ namespace Content.Server.GameTicking
|
|||||||
Loc.GetString("job-greet-station-name", ("stationName", metaData.EntityName)));
|
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.
|
// We raise this event directed to the mob, but also broadcast it so game rules can do something now.
|
||||||
PlayersJoinedRoundNormally++;
|
PlayersJoinedRoundNormally++;
|
||||||
var aev = new PlayerSpawnCompleteEvent(mob,
|
var aev = new PlayerSpawnCompleteEvent(mob,
|
||||||
player,
|
player,
|
||||||
jobId,
|
jobId,
|
||||||
lateJoin,
|
lateJoin,
|
||||||
|
silent,
|
||||||
PlayersJoinedRoundNormally,
|
PlayersJoinedRoundNormally,
|
||||||
station,
|
station,
|
||||||
character);
|
character);
|
||||||
@@ -314,7 +300,7 @@ namespace Content.Server.GameTicking
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="player">The player joining</param>
|
/// <param name="player">The player joining</param>
|
||||||
/// <param name="station">The station they're spawning on</param>
|
/// <param name="station">The station they're spawning on</param>
|
||||||
@@ -494,6 +480,7 @@ namespace Content.Server.GameTicking
|
|||||||
public ICommonSession Player { get; }
|
public ICommonSession Player { get; }
|
||||||
public string? JobId { get; }
|
public string? JobId { get; }
|
||||||
public bool LateJoin { get; }
|
public bool LateJoin { get; }
|
||||||
|
public bool Silent { get; }
|
||||||
public EntityUid Station { get; }
|
public EntityUid Station { get; }
|
||||||
public HumanoidCharacterProfile Profile { get; }
|
public HumanoidCharacterProfile Profile { get; }
|
||||||
|
|
||||||
@@ -504,6 +491,7 @@ namespace Content.Server.GameTicking
|
|||||||
ICommonSession player,
|
ICommonSession player,
|
||||||
string? jobId,
|
string? jobId,
|
||||||
bool lateJoin,
|
bool lateJoin,
|
||||||
|
bool silent,
|
||||||
int joinOrder,
|
int joinOrder,
|
||||||
EntityUid station,
|
EntityUid station,
|
||||||
HumanoidCharacterProfile profile)
|
HumanoidCharacterProfile profile)
|
||||||
@@ -512,6 +500,7 @@ namespace Content.Server.GameTicking
|
|||||||
Player = player;
|
Player = player;
|
||||||
JobId = jobId;
|
JobId = jobId;
|
||||||
LateJoin = lateJoin;
|
LateJoin = lateJoin;
|
||||||
|
Silent = silent;
|
||||||
Station = station;
|
Station = station;
|
||||||
Profile = profile;
|
Profile = profile;
|
||||||
JoinOrder = joinOrder;
|
JoinOrder = joinOrder;
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<ArrivalsShuttleComponent, FTLStartedEvent>(OnArrivalsFTL);
|
SubscribeLocalEvent<ArrivalsShuttleComponent, FTLStartedEvent>(OnArrivalsFTL);
|
||||||
SubscribeLocalEvent<ArrivalsShuttleComponent, FTLCompletedEvent>(OnArrivalsDocked);
|
SubscribeLocalEvent<ArrivalsShuttleComponent, FTLCompletedEvent>(OnArrivalsDocked);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(SendDirections);
|
||||||
|
|
||||||
_pendingQuery = GetEntityQuery<PendingClockInComponent>();
|
_pendingQuery = GetEntityQuery<PendingClockInComponent>();
|
||||||
_blacklistQuery = GetEntityQuery<ArrivalsBlacklistComponent>();
|
_blacklistQuery = GetEntityQuery<ArrivalsBlacklistComponent>();
|
||||||
_mobQuery = GetEntityQuery<MobStateComponent>();
|
_mobQuery = GetEntityQuery<MobStateComponent>();
|
||||||
@@ -378,6 +380,20 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||||||
EnsureComp<GodmodeComponent>(ev.SpawnResult.Value);
|
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)
|
private bool TryTeleportToMapSpawn(EntityUid player, EntityUid stationId, TransformComponent? transform = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(player, ref transform))
|
if (!Resolve(player, ref transform))
|
||||||
|
|||||||
Reference in New Issue
Block a user