Add role prototype validation tests (#32801)

* Add role prototype validation test

* Rejig GetPrototypesWithComponent

* More tests n stuff
This commit is contained in:
Leon Friedrich
2024-10-14 16:05:25 +13:00
committed by GitHub
parent 870eb439f3
commit 4e0018697f
9 changed files with 241 additions and 125 deletions

View File

@@ -103,7 +103,6 @@ public abstract class SharedJobSystem : EntitySystem
public bool MindHasJobWithId(EntityUid? mindId, string prototypeId)
{
MindRoleComponent? comp = null;
if (mindId is null)
return false;
@@ -112,9 +111,7 @@ public abstract class SharedJobSystem : EntitySystem
if (role is null)
return false;
comp = role.Value.Comp;
return (comp.JobPrototype == prototypeId);
return role.Value.Comp1.JobPrototype == prototypeId;
}
public bool MindTryGetJob(
@@ -124,7 +121,7 @@ public abstract class SharedJobSystem : EntitySystem
prototype = null;
MindTryGetJobId(mindId, out var protoId);
return (_prototypes.TryIndex<JobPrototype>(protoId, out prototype) || prototype is not null);
return _prototypes.TryIndex(protoId, out prototype) || prototype is not null;
}
public bool MindTryGetJobId(
@@ -137,9 +134,9 @@ public abstract class SharedJobSystem : EntitySystem
return false;
if (_roles.MindHasRole<JobRoleComponent>(mindId.Value, out var role))
job = role.Value.Comp.JobPrototype;
job = role.Value.Comp1.JobPrototype;
return (job is not null);
return job is not null;
}
/// <summary>