Add role prototype validation tests (#32801)
* Add role prototype validation test * Rejig GetPrototypesWithComponent * More tests n stuff
This commit is contained in:
@@ -26,9 +26,17 @@ public sealed partial class JobCondition : EntityEffectCondition
|
||||
if(!args.EntityManager.HasComponent<JobRoleComponent>(roleId))
|
||||
continue;
|
||||
|
||||
if(!args.EntityManager.TryGetComponent<MindRoleComponent>(roleId, out var mindRole)
|
||||
|| mindRole.JobPrototype is null)
|
||||
if (!args.EntityManager.TryGetComponent<MindRoleComponent>(roleId, out var mindRole))
|
||||
{
|
||||
Logger.Error($"Encountered job mind role entity {roleId} without a {nameof(MindRoleComponent)}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mindRole.JobPrototype == null)
|
||||
{
|
||||
Logger.Error($"Encountered job mind role entity {roleId} without a {nameof(JobPrototype)}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Job.Contains(mindRole.JobPrototype.Value))
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user