diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 9b94d6024e2..79b740d921d 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -60,6 +60,7 @@ public sealed class ArrivalsSystem : EntitySystem [Dependency] private readonly StationSpawningSystem _stationSpawning = default!; [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly ActorSystem _actor = default!; + [Dependency] private readonly ContainerSpawnPointSystem _containerSpawnPointSystem = default!; private EntityQuery _pendingQuery; private EntityQuery _blacklistQuery; @@ -338,6 +339,16 @@ public void HandlePlayerSpawning(PlayerSpawningEvent ev) if (!Enabled || _ticker.RunLevel != GameRunLevel.InRound) return; + // ADT station AI tweak start + if (ev.Job != null && + ev.Job.Prototype.HasValue && + _protoManager.Index(ev.Job.Prototype.Value).ContainerInsert) + { + _containerSpawnPointSystem.HandlePlayerSpawning(ev, true); + return; + } + // ADT station AI tweak end + if (!HasComp(ev.Station)) return; diff --git a/Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs b/Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs index ef0ece524c0..a0efe021383 100644 --- a/Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs +++ b/Content.Server/Spawners/EntitySystems/ContainerSpawnPointSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Station.Systems; using Robust.Server.Containers; using Robust.Shared.Containers; +using Robust.Shared.Prototypes; using Robust.Shared.Random; namespace Content.Server.Spawners.EntitySystems; @@ -14,6 +15,7 @@ public sealed class ContainerSpawnPointSystem : EntitySystem [Dependency] private readonly ContainerSystem _container = default!; [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly StationSpawningSystem _stationSpawning = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; public override void Initialize() { @@ -21,7 +23,18 @@ public override void Initialize() SubscribeLocalEvent(HandlePlayerSpawning, before: new []{ typeof(SpawnPointSystem) }); } - public void HandlePlayerSpawning(PlayerSpawningEvent args) + public void HandlePlayerSpawning(PlayerSpawningEvent args) // ADT station AI tweak + { + if (args.Job != null && + args.Job.Prototype.HasValue && + _proto.Index(args.Job.Prototype.Value).ContainerInsert) + HandlePlayerSpawning(args, true); // ADT station AI tweak + else + HandlePlayerSpawning(args, false); // ADT station AI tweak + } + + // ADT station AI tweak start + public void HandlePlayerSpawning(PlayerSpawningEvent args, bool forceJob = false) { if (args.SpawnResult != null) return; @@ -34,25 +47,38 @@ public void HandlePlayerSpawning(PlayerSpawningEvent args) if (args.Station != null && _station.GetOwningStation(uid, xform) != args.Station) continue; - // If it's unset, then we allow it to be used for both roundstart and midround joins - if (spawnPoint.SpawnType == SpawnPointType.Unset) + if (forceJob) { - // make sure we also check the job here for various reasons. - if (spawnPoint.Job == null || spawnPoint.Job == args.Job?.Prototype) + if (spawnPoint.SpawnType == SpawnPointType.Job && + args.Job != null && + spawnPoint.Job == args.Job.Prototype) + { possibleContainers.Add((uid, spawnPoint, container, xform)); - continue; + } } - if (_gameTicker.RunLevel == GameRunLevel.InRound && spawnPoint.SpawnType == SpawnPointType.LateJoin) + else { - possibleContainers.Add((uid, spawnPoint, container, xform)); - } + // If it's unset, then we allow it to be used for both roundstart and midround joins + if (spawnPoint.SpawnType == SpawnPointType.Unset) + { + // make sure we also check the job here for various reasons. + if (spawnPoint.Job == null || spawnPoint.Job == args.Job?.Prototype) + possibleContainers.Add((uid, spawnPoint, container, xform)); + continue; + } - if (_gameTicker.RunLevel != GameRunLevel.InRound && - spawnPoint.SpawnType == SpawnPointType.Job && - (args.Job == null || spawnPoint.Job == args.Job.Prototype)) - { - possibleContainers.Add((uid, spawnPoint, container, xform)); + if (_gameTicker.RunLevel == GameRunLevel.InRound && spawnPoint.SpawnType == SpawnPointType.LateJoin) + { + possibleContainers.Add((uid, spawnPoint, container, xform)); + } + + if (_gameTicker.RunLevel != GameRunLevel.InRound && + spawnPoint.SpawnType == SpawnPointType.Job && + (args.Job == null || spawnPoint.Job == args.Job.Prototype)) + { + possibleContainers.Add((uid, spawnPoint, container, xform)); + } } } @@ -82,4 +108,5 @@ public void HandlePlayerSpawning(PlayerSpawningEvent args) Del(args.SpawnResult); args.SpawnResult = null; } + // ADT station AI tweak end } diff --git a/Content.Shared/Roles/JobPrototype.cs b/Content.Shared/Roles/JobPrototype.cs index e7156b34c3b..cafbac1ec3e 100644 --- a/Content.Shared/Roles/JobPrototype.cs +++ b/Content.Shared/Roles/JobPrototype.cs @@ -125,6 +125,11 @@ public sealed partial class JobPrototype : IPrototype /// [DataField] public List>? Guides; + + // ADT station AI tweak start + [DataField] + public bool ContainerInsert = false; + // ADT station AI tweak end } /// diff --git a/Resources/Prototypes/Roles/Jobs/Science/borg.yml b/Resources/Prototypes/Roles/Jobs/Science/borg.yml index fffeaff39c5..c07b145900b 100644 --- a/Resources/Prototypes/Roles/Jobs/Science/borg.yml +++ b/Resources/Prototypes/Roles/Jobs/Science/borg.yml @@ -12,6 +12,7 @@ icon: JobIconStationAi supervisors: job-supervisors-rd jobEntity: StationAiBrain + containerInsert: true - type: job id: Borg