From 66c4dfaa8e104037e26d708a1adb9891225338a7 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 11 Sep 2023 18:10:07 +1000 Subject: [PATCH] Fix tests (#20017) --- .../Tests/Station/StationJobsTest.cs | 24 ++++++++++++++----- Content.Shared/Roles/Jobs/SharedJobSystem.cs | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Content.IntegrationTests/Tests/Station/StationJobsTest.cs b/Content.IntegrationTests/Tests/Station/StationJobsTest.cs index 1748e944e7..0085472c33 100644 --- a/Content.IntegrationTests/Tests/Station/StationJobsTest.cs +++ b/Content.IntegrationTests/Tests/Station/StationJobsTest.cs @@ -21,7 +21,19 @@ public sealed class StationJobsTest [TestPrototypes] private const string Prototypes = @" - type: playTimeTracker - id: PlayTimeDummy + id: PlayTimeDummyAssistant + +- type: playTimeTracker + id: PlayTimeDummyMime + +- type: playTimeTracker + id: PlayTimeDummyClown + +- type: playTimeTracker + id: PlayTimeDummyCaptain + +- type: playTimeTracker + id: PlayTimeDummyChaplain - type: gameMap id: FooStation @@ -44,26 +56,26 @@ public sealed class StationJobsTest - type: job id: TAssistant - playTimeTracker: PlayTimeDummy + playTimeTracker: PlayTimeDummyAssistant - type: job id: TMime weight: 20 - playTimeTracker: PlayTimeDummy + playTimeTracker: PlayTimeDummyMime - type: job id: TClown weight: -10 - playTimeTracker: PlayTimeDummy + playTimeTracker: PlayTimeDummyClown - type: job id: TCaptain weight: 10 - playTimeTracker: PlayTimeDummy + playTimeTracker: PlayTimeDummyCaptain - type: job id: TChaplain - playTimeTracker: PlayTimeDummy + playTimeTracker: PlayTimeDummyChaplain "; private const int StationCount = 100; diff --git a/Content.Shared/Roles/Jobs/SharedJobSystem.cs b/Content.Shared/Roles/Jobs/SharedJobSystem.cs index 6ab5776a77..ac18d04e9c 100644 --- a/Content.Shared/Roles/Jobs/SharedJobSystem.cs +++ b/Content.Shared/Roles/Jobs/SharedJobSystem.cs @@ -30,17 +30,17 @@ public abstract class SharedJobSystem : EntitySystem { base.Shutdown(); _protoManager.PrototypesReloaded -= OnProtoReload; - _inverseTrackerLookup.Clear(); } private void OnProtoReload(PrototypesReloadedEventArgs obj) { - _inverseTrackerLookup.Clear(); SetupTrackerLookup(); } private void SetupTrackerLookup() { + _inverseTrackerLookup.Clear(); + // This breaks if you have N trackers to 1 JobId but future concern. foreach (var job in _protoManager.EnumeratePrototypes()) { -- 2.51.2