Implement applicant pool functionality in school simulation, allowing for the management of job seekers who are not yet part of the school roster. Update the catalog to include staffing definitions and enhance the API to support applicant data retrieval. Revise the school architecture to handle applicant refresh logic and ensure proper integration with existing roster management. Update tests to validate the new applicant functionalities and ensure robustness in handling staffing scenarios.
This commit is contained in:
@@ -34,6 +34,16 @@ internal static class PeopleDefValidator
|
||||
ValidateSubject(subject, catalog);
|
||||
}
|
||||
|
||||
foreach (var staffing in catalog.Staffing.Values)
|
||||
{
|
||||
ValidateStaffing(staffing);
|
||||
}
|
||||
|
||||
if (catalog.Staffing.Values.Count(def => !def.Abstract) > 1)
|
||||
{
|
||||
throw new ContentLoadException("A catalog may only have one concrete StaffingDef.");
|
||||
}
|
||||
|
||||
RequireBuildInputs(catalog);
|
||||
}
|
||||
|
||||
@@ -260,6 +270,34 @@ internal static class PeopleDefValidator
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValidateStaffing(StaffingDef staffing)
|
||||
{
|
||||
if (staffing.Abstract)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (staffing.PoolSize < 1 || staffing.PoolSize > 64)
|
||||
{
|
||||
throw new ContentLoadException($"StaffingDef '{staffing.DefName}' poolSize must be 1–64.");
|
||||
}
|
||||
|
||||
if (staffing.StayChance <= 0f || staffing.StayChance >= 1f)
|
||||
{
|
||||
throw new ContentLoadException($"StaffingDef '{staffing.DefName}' stayChance must be between 0 and 1 exclusive.");
|
||||
}
|
||||
|
||||
if (staffing.ParentChance < 0f || staffing.ParentChance > 1f)
|
||||
{
|
||||
throw new ContentLoadException($"StaffingDef '{staffing.DefName}' parentChance must be 0–1.");
|
||||
}
|
||||
|
||||
if (staffing.HourlyWageBase < 0f || staffing.HourlyWagePerSkill < 0f)
|
||||
{
|
||||
throw new ContentLoadException($"StaffingDef '{staffing.DefName}' wage scale cannot be negative.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValidateNameSet(NameSetDef names)
|
||||
{
|
||||
if (!NameGrammar.IsKnownPatronymic(names.PatronymicRule))
|
||||
|
||||
Reference in New Issue
Block a user