Fix RA0032 (#32514)

This commit is contained in:
nikthechampiongr
2024-09-29 03:25:21 +03:00
committed by GitHub
parent 1b9d77a760
commit a5840b925b
27 changed files with 51 additions and 92 deletions

View File

@@ -15,8 +15,6 @@ public abstract class SharedJobSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypes = default!;
[Dependency] private readonly SharedPlayerSystem _playerSystem = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
private readonly Dictionary<string, string> _inverseTrackerLookup = new();
public override void Initialize()
@@ -37,7 +35,7 @@ public abstract class SharedJobSystem : EntitySystem
_inverseTrackerLookup.Clear();
// This breaks if you have N trackers to 1 JobId but future concern.
foreach (var job in _protoManager.EnumeratePrototypes<JobPrototype>())
foreach (var job in _prototypes.EnumeratePrototypes<JobPrototype>())
{
_inverseTrackerLookup.Add(job.PlayTimeTracker, job.ID);
}
@@ -50,7 +48,7 @@ public abstract class SharedJobSystem : EntitySystem
/// <returns></returns>
public string GetJobPrototype(string trackerProto)
{
DebugTools.Assert(_protoManager.HasIndex<PlayTimeTrackerPrototype>(trackerProto));
DebugTools.Assert(_prototypes.HasIndex<PlayTimeTrackerPrototype>(trackerProto));
return _inverseTrackerLookup[trackerProto];
}
@@ -60,7 +58,7 @@ public abstract class SharedJobSystem : EntitySystem
public bool TryGetDepartment(string jobProto, [NotNullWhen(true)] out DepartmentPrototype? departmentPrototype)
{
// Not that many departments so we can just eat the cost instead of storing the inverse lookup.
var departmentProtos = _protoManager.EnumeratePrototypes<DepartmentPrototype>().ToList();
var departmentProtos = _prototypes.EnumeratePrototypes<DepartmentPrototype>().ToList();
departmentProtos.Sort((x, y) => string.Compare(x.ID, y.ID, StringComparison.Ordinal));
foreach (var department in departmentProtos)
@@ -85,7 +83,7 @@ public abstract class SharedJobSystem : EntitySystem
{
// not sorting it since there should only be 1 primary department for a job.
// this is enforced by the job tests.
var departmentProtos = _protoManager.EnumeratePrototypes<DepartmentPrototype>();
var departmentProtos = _prototypes.EnumeratePrototypes<DepartmentPrototype>();
foreach (var department in departmentProtos)
{