diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index c168e43c69..7996f8e1ea 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -65,9 +65,17 @@ namespace Content.Server.GameTicking // Calculate extended access for stations. var stationJobCounts = _stationSystem.Stations.ToDictionary(e => e, _ => 0); - foreach (var (_, (_, station)) in assignedJobs) + foreach (var (netUser, (job, station)) in assignedJobs) { - stationJobCounts[station] += 1; + if (job == null) + { + var playerSession = _playerManager.GetSessionByUserId(netUser); + _chatManager.DispatchServerMessage(playerSession, Loc.GetString("job-not-available-wait-in-lobby")); + } + else + { + stationJobCounts[station] += 1; + } } _stationJobs.CalcExtendedAccess(stationJobCounts); @@ -75,6 +83,9 @@ namespace Content.Server.GameTicking // Spawn everybody in! foreach (var (player, (job, station)) in assignedJobs) { + if (job == null) + continue; + SpawnPlayer(_playerManager.GetSessionByUserId(player), profiles[player], station, job, false); } diff --git a/Content.Server/Station/Systems/StationJobsSystem.Roundstart.cs b/Content.Server/Station/Systems/StationJobsSystem.Roundstart.cs index 4d30330dbe..a618e74c26 100644 --- a/Content.Server/Station/Systems/StationJobsSystem.Roundstart.cs +++ b/Content.Server/Station/Systems/StationJobsSystem.Roundstart.cs @@ -1,7 +1,6 @@ -using System.Linq; +using System.Linq; using Content.Server.Administration.Managers; using Content.Server.Players.PlayTimeTracking; -using Content.Server.Roles; using Content.Server.Station.Components; using Content.Shared.Preferences; 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. /// A warning to all who enter ye cursed lands: This function is long and mildly incomprehensible. Best used without touching. /// - public Dictionary AssignJobs(Dictionary profiles, IReadOnlyList stations, bool useRoundStartJobs = true) + public Dictionary AssignJobs(Dictionary profiles, IReadOnlyList stations, bool useRoundStartJobs = true) { DebugTools.Assert(stations.Count > 0); InitializeRoundStart(); if (profiles.Count == 0) - return new Dictionary(); + return new Dictionary(); // We need to modify this collection later, so make a copy of it. profiles = profiles.ShallowClone(); // Player <-> (job, station) - var assigned = new Dictionary(profiles.Count); + var assigned = new Dictionary(profiles.Count); // The jobs left on the stations. This collection is modified as jobs are assigned to track what's available. var stationJobs = new Dictionary>(); @@ -273,7 +272,7 @@ public sealed partial class StationJobsSystem /// All players that might need an overflow assigned. /// Player character profiles. /// The stations to consider for spawn location. - public void AssignOverflowJobs(ref Dictionary assignedJobs, + public void AssignOverflowJobs(ref Dictionary assignedJobs, IEnumerable allPlayersToAssign, IReadOnlyDictionary profiles, IReadOnlyList stations) { var givenStations = stations.ToList(); @@ -289,8 +288,11 @@ public sealed partial class StationJobsSystem var profile = profiles[player]; if (profile.PreferenceUnavailable != PreferenceUnavailableMode.SpawnAsOverflow) + { + assignedJobs.Add(player, (null, EntityUid.Invalid)); continue; - + } + _random.Shuffle(givenStations); foreach (var station in givenStations) diff --git a/Resources/Locale/en-US/job/job.ftl b/Resources/Locale/en-US/job/job.ftl index ebcc3a76ab..d999c0d92d 100644 --- a/Resources/Locale/en-US/job/job.ftl +++ b/Resources/Locale/en-US/job/job.ftl @@ -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-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-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. \ No newline at end of file