Show a message when players chose to remain in the lobby due to preferences. (#12130)
This commit is contained in:
@@ -65,16 +65,27 @@ namespace Content.Server.GameTicking
|
|||||||
|
|
||||||
// Calculate extended access for stations.
|
// Calculate extended access for stations.
|
||||||
var stationJobCounts = _stationSystem.Stations.ToDictionary(e => e, _ => 0);
|
var stationJobCounts = _stationSystem.Stations.ToDictionary(e => e, _ => 0);
|
||||||
foreach (var (_, (_, station)) in assignedJobs)
|
foreach (var (netUser, (job, station)) in assignedJobs)
|
||||||
|
{
|
||||||
|
if (job == null)
|
||||||
|
{
|
||||||
|
var playerSession = _playerManager.GetSessionByUserId(netUser);
|
||||||
|
_chatManager.DispatchServerMessage(playerSession, Loc.GetString("job-not-available-wait-in-lobby"));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
stationJobCounts[station] += 1;
|
stationJobCounts[station] += 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_stationJobs.CalcExtendedAccess(stationJobCounts);
|
_stationJobs.CalcExtendedAccess(stationJobCounts);
|
||||||
|
|
||||||
// Spawn everybody in!
|
// Spawn everybody in!
|
||||||
foreach (var (player, (job, station)) in assignedJobs)
|
foreach (var (player, (job, station)) in assignedJobs)
|
||||||
{
|
{
|
||||||
|
if (job == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
SpawnPlayer(_playerManager.GetSessionByUserId(player), profiles[player], station, job, false);
|
SpawnPlayer(_playerManager.GetSessionByUserId(player), profiles[player], station, job, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Administration.Managers;
|
using Content.Server.Administration.Managers;
|
||||||
using Content.Server.Players.PlayTimeTracking;
|
using Content.Server.Players.PlayTimeTracking;
|
||||||
using Content.Server.Roles;
|
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
using Content.Shared.Roles;
|
using Content.Shared.Roles;
|
||||||
@@ -52,20 +51,20 @@ public sealed partial class StationJobsSystem
|
|||||||
/// as there may end up being more round-start slots than available slots, which can cause weird behavior.
|
/// as there may end up being more round-start slots than available slots, which can cause weird behavior.
|
||||||
/// A warning to all who enter ye cursed lands: This function is long and mildly incomprehensible. Best used without touching.
|
/// A warning to all who enter ye cursed lands: This function is long and mildly incomprehensible. Best used without touching.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public Dictionary<NetUserId, (string, EntityUid)> AssignJobs(Dictionary<NetUserId, HumanoidCharacterProfile> profiles, IReadOnlyList<EntityUid> stations, bool useRoundStartJobs = true)
|
public Dictionary<NetUserId, (string?, EntityUid)> AssignJobs(Dictionary<NetUserId, HumanoidCharacterProfile> profiles, IReadOnlyList<EntityUid> stations, bool useRoundStartJobs = true)
|
||||||
{
|
{
|
||||||
DebugTools.Assert(stations.Count > 0);
|
DebugTools.Assert(stations.Count > 0);
|
||||||
|
|
||||||
InitializeRoundStart();
|
InitializeRoundStart();
|
||||||
|
|
||||||
if (profiles.Count == 0)
|
if (profiles.Count == 0)
|
||||||
return new Dictionary<NetUserId, (string, EntityUid)>();
|
return new Dictionary<NetUserId, (string?, EntityUid)>();
|
||||||
|
|
||||||
// We need to modify this collection later, so make a copy of it.
|
// We need to modify this collection later, so make a copy of it.
|
||||||
profiles = profiles.ShallowClone();
|
profiles = profiles.ShallowClone();
|
||||||
|
|
||||||
// Player <-> (job, station)
|
// Player <-> (job, station)
|
||||||
var assigned = new Dictionary<NetUserId, (string, EntityUid)>(profiles.Count);
|
var assigned = new Dictionary<NetUserId, (string?, EntityUid)>(profiles.Count);
|
||||||
|
|
||||||
// The jobs left on the stations. This collection is modified as jobs are assigned to track what's available.
|
// The jobs left on the stations. This collection is modified as jobs are assigned to track what's available.
|
||||||
var stationJobs = new Dictionary<EntityUid, Dictionary<string, uint?>>();
|
var stationJobs = new Dictionary<EntityUid, Dictionary<string, uint?>>();
|
||||||
@@ -273,7 +272,7 @@ public sealed partial class StationJobsSystem
|
|||||||
/// <param name="allPlayersToAssign">All players that might need an overflow assigned.</param>
|
/// <param name="allPlayersToAssign">All players that might need an overflow assigned.</param>
|
||||||
/// <param name="profiles">Player character profiles.</param>
|
/// <param name="profiles">Player character profiles.</param>
|
||||||
/// <param name="stations">The stations to consider for spawn location.</param>
|
/// <param name="stations">The stations to consider for spawn location.</param>
|
||||||
public void AssignOverflowJobs(ref Dictionary<NetUserId, (string, EntityUid)> assignedJobs,
|
public void AssignOverflowJobs(ref Dictionary<NetUserId, (string?, EntityUid)> assignedJobs,
|
||||||
IEnumerable<NetUserId> allPlayersToAssign, IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> profiles, IReadOnlyList<EntityUid> stations)
|
IEnumerable<NetUserId> allPlayersToAssign, IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> profiles, IReadOnlyList<EntityUid> stations)
|
||||||
{
|
{
|
||||||
var givenStations = stations.ToList();
|
var givenStations = stations.ToList();
|
||||||
@@ -289,7 +288,10 @@ public sealed partial class StationJobsSystem
|
|||||||
|
|
||||||
var profile = profiles[player];
|
var profile = profiles[player];
|
||||||
if (profile.PreferenceUnavailable != PreferenceUnavailableMode.SpawnAsOverflow)
|
if (profile.PreferenceUnavailable != PreferenceUnavailableMode.SpawnAsOverflow)
|
||||||
|
{
|
||||||
|
assignedJobs.Add(player, (null, EntityUid.Invalid));
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
_random.Shuffle(givenStations);
|
_random.Shuffle(givenStations);
|
||||||
|
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ job-greet-introduce-job-name = Your role is: {$jobName}.
|
|||||||
job-greet-important-disconnect-admin-notify = You are playing a job that is important for Game Progression. If you have to disconnect, please notify the admins via ahelp.
|
job-greet-important-disconnect-admin-notify = You are playing a job that is important for Game Progression. If you have to disconnect, please notify the admins via ahelp.
|
||||||
job-greet-supervisors-warning = As the {$jobName} you answer directly to {$supervisors}. Special circumstances may change this.
|
job-greet-supervisors-warning = As the {$jobName} you answer directly to {$supervisors}. Special circumstances may change this.
|
||||||
job-greet-crew-shortages = As this station was initially staffed with a skeleton crew, additional access has been added to your ID card.
|
job-greet-crew-shortages = As this station was initially staffed with a skeleton crew, additional access has been added to your ID card.
|
||||||
|
job-not-available-wait-in-lobby = The round has started, but you did not receive any of your preferred job roles (or have no preferred job roles selected) and chose to remain in the lobby. You can change this behavior on the customization screen.
|
||||||
Reference in New Issue
Block a user