From 635e8002203680b10bad17c22edee9304a0a9bfa Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:23:24 +1000 Subject: [PATCH] Reapply "Fix spawnpref" (#32018) (#32058) This reverts commit 119dd610fa30edd3927cd51acbc68601f7d0b8e0. --- Content.Server/Shuttles/Systems/ArrivalsSystem.cs | 4 ++++ .../EntitySystems/ContainerSpawnPointSystem.cs | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 9b94d6024e2a..82a38f5f00fe 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -22,6 +22,7 @@ using Content.Shared.Mobs.Components; using Content.Shared.Movement.Components; using Content.Shared.Parallax.Biomes; +using Content.Shared.Preferences; using Content.Shared.Salvage; using Content.Shared.Shuttles.Components; using Content.Shared.Tiles; @@ -334,6 +335,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 ef0ece524c02..69baf591bcaa 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,6 +14,7 @@ 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!; @@ -26,6 +30,13 @@ public void HandlePlayerSpawning(PlayerSpawningEvent args) if (args.SpawnResult != null) return; + // 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(); var possibleContainers = new List>();