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

@@ -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;