diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs
index 9dabf6f40a0..f7b5f220e25 100644
--- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs
+++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs
@@ -10,6 +10,7 @@
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Spawners.Components;
+using Content.Server.Spawners.EntitySystems;
using Content.Server.Station.Components;
using Content.Server.Station.Events;
using Content.Server.Station.Systems;
@@ -20,6 +21,7 @@
using Content.Shared.Movement.Components;
using Content.Shared.Parallax.Biomes;
using Content.Shared.Roles;
+using Content.Shared.Preferences;
using Content.Shared.Salvage;
using Content.Shared.Shuttles.Components;
using Content.Shared.Tiles;
@@ -64,6 +66,11 @@ public sealed class ArrivalsSystem : EntitySystem
///
public bool Enabled { get; private set; }
+ ///
+ /// Flags if all players spawning at the departure terminal have godmode until they leave the terminal.
+ ///
+ public bool ArrivalsGodmode { get; private set; }
+
///
/// The first arrival is a little early, to save everyone 10s
///
@@ -80,6 +87,8 @@ public override void Initialize()
{
base.Initialize();
+ SubscribeLocalEvent(HandlePlayerSpawning, before: new []{ typeof(ContainerSpawnPointSystem), typeof(SpawnPointSystem)});
+
SubscribeLocalEvent(OnStationPostInit);
SubscribeLocalEvent(OnShuttleStartup);
@@ -95,7 +104,10 @@ public override void Initialize()
// Don't invoke immediately as it will get set in the natural course of things.
Enabled = _cfgManager.GetCVar(CCVars.ArrivalsShuttles);
- Subs.CVar(_cfgManager, CCVars.ArrivalsShuttles, SetArrivals);
+ ArrivalsGodmode = _cfgManager.GetCVar(CCVars.GodmodeArrivals);
+
+ _cfgManager.OnValueChanged(CCVars.ArrivalsShuttles, SetArrivals);
+ _cfgManager.OnValueChanged(CCVars.GodmodeArrivals, b => ArrivalsGodmode = b);
// Command so admins can set these for funsies
_console.RegisterCommand("arrivals", ArrivalsCommand, ArrivalsCompletion);
@@ -309,6 +321,9 @@ public void HandlePlayerSpawning(PlayerSpawningEvent ev)
if (ev.SpawnResult != null)
return;
+ if (ev.HumanoidCharacterProfile?.SpawnPriority != SpawnPriorityPreference.Arrivals)
+ return;
+
// Only works on latejoin even if enabled.
if (!Enabled || _ticker.RunLevel != GameRunLevel.InRound)
return;
diff --git a/Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs b/Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs
index 4d38571b90f..6b0033124e5 100644
--- a/Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs
+++ b/Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs
@@ -1,8 +1,11 @@
using Content.Server.GameTicking;
using Content.Server.Spawners.Components;
using Content.Server.Station.Systems;
+using Content.Shared.Preferences;
+using Content.Shared.Roles;
using Robust.Server.Containers;
using Robust.Shared.Containers;
+using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.Spawners.EntitySystems;
@@ -11,17 +14,25 @@ public sealed class ContainerSpawnPointSystem : EntitySystem
{
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly IRobustRandom _random = default!;
+ [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent(HandlePlayerSpawning, before: new []{ typeof(SpawnPointSystem) });
+ }
+
public void HandlePlayerSpawning(PlayerSpawningEvent args)
{
if (args.SpawnResult != null)
return;
- // DeltaV - Ignore these two desired spawn types
- if (args.DesiredSpawnPointType is SpawnPointType.Observer or SpawnPointType.LateJoin)
+ // If it's just a spawn pref check if it's for cryo (silly).
+ if (args.HumanoidCharacterProfile?.SpawnPriority != SpawnPriorityPreference.Cryosleep &&
+ (!_proto.TryIndex(args.Job?.Prototype, out var jobProto) || jobProto.JobEntity == null))
return;
var query = EntityQueryEnumerator();
@@ -33,11 +44,12 @@ public void HandlePlayerSpawning(PlayerSpawningEvent args)
continue;
// DeltaV - Custom override for override spawnpoints, only used for prisoners currently. This shouldn't run for any other jobs
- if (args.DesiredSpawnPointType == SpawnPointType.Job)
+ if (args.DesiredSpawnPointType == SpawnPointType.Job
+ && spawnPoint.SpawnType == SpawnPointType.Job
+ && args.Job is not null
+ && spawnPoint.Job is not ""
+ && spawnPoint.Job == args.Job.Prototype)
{
- if (spawnPoint.SpawnType != SpawnPointType.Job || spawnPoint.Job != args.Job?.Prototype)
- continue;
-
possibleContainers.Add((uid, spawnPoint, container, xform));
continue;
}
diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs
index 66a95549543..85f5662b421 100644
--- a/Content.Server/Station/Systems/StationSpawningSystem.cs
+++ b/Content.Server/Station/Systems/StationSpawningSystem.cs
@@ -53,19 +53,11 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
private bool _randomizeCharacters;
- private Dictionary> _spawnerCallbacks = new();
-
///
public override void Initialize()
{
base.Initialize();
Subs.CVar(_configurationManager, CCVars.ICRandomCharacters, e => _randomizeCharacters = e, true);
-
- _spawnerCallbacks = new Dictionary>()
- {
- { SpawnPriorityPreference.Arrivals, _arrivalsSystem.HandlePlayerSpawning },
- { SpawnPriorityPreference.Cryosleep, _containerSpawnPointSystem.HandlePlayerSpawning }
- };
}
///
@@ -88,31 +80,7 @@ public override void Initialize()
var ev = new PlayerSpawningEvent(job, profile, station, spawnPointType);
- if (station != null && profile != null)
- {
- // Try to call the character's preferred spawner first.
- if (_spawnerCallbacks.TryGetValue(profile.SpawnPriority, out var preferredSpawner))
- {
- preferredSpawner(ev);
-
- foreach (var (key, remainingSpawner) in _spawnerCallbacks)
- {
- if (key == profile.SpawnPriority)
- continue;
-
- remainingSpawner(ev);
- }
- }
- else
- {
- // Call all of them in the typical order.
- foreach (var typicalSpawner in _spawnerCallbacks.Values)
- typicalSpawner(ev);
- }
- }
-
RaiseLocalEvent(ev);
-
DebugTools.Assert(ev.SpawnResult is { Valid: true } or null);
return ev.SpawnResult;
diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs
index c93eaa77f90..28055d866e8 100644
--- a/Content.Shared/CCVar/CCVars.cs
+++ b/Content.Shared/CCVar/CCVars.cs
@@ -1738,6 +1738,19 @@ public static readonly CVarDef
public static readonly CVarDef ArrivalsReturns =
CVarDef.Create("shuttle.arrivals_returns", false, CVar.SERVERONLY);
+ ///
+ /// Should all players who spawn at arrivals have godmode until they leave the map?
+ ///
+ public static readonly CVarDef GodmodeArrivals =
+ CVarDef.Create("shuttle.godmode_arrivals", false, CVar.SERVERONLY);
+
+ ///
+ /// If a grid is split then hide any smaller ones under this mass (kg) from the map.
+ /// This is useful to avoid split grids spamming out labels.
+ ///
+ public static readonly CVarDef HideSplitGridsUnder =
+ CVarDef.Create("shuttle.hide_split_grids_under", 30, CVar.SERVERONLY);
+
///
/// Whether to automatically spawn escape shuttles.
///