Restore Slavic save lift and redress abstract underwear on load.
Recheck of slice 7 stage A found UpgradeOlderSave removed after UpperUnderwear, so format-2 nameSetId saves never started, and golden people.json wearing abstract Underwear failed RequireKnownApparel. Bring back the lift, treat unusable items as undressed, and restore GoldenSaveTests.
This commit is contained in:
@@ -71,7 +71,7 @@ public static class DressGenerator
|
||||
int? pupilYear,
|
||||
int age)
|
||||
{
|
||||
if (person.Items.Count > 0)
|
||||
if (person.Items.Count > 0 && ItemsUsable(catalog, person.Items))
|
||||
{
|
||||
return person;
|
||||
}
|
||||
@@ -130,11 +130,12 @@ public static class DressGenerator
|
||||
return pool with { Applicants = applicants };
|
||||
}
|
||||
|
||||
public static bool NeedsDressing(Roster roster, ApplicantPool? pool)
|
||||
public static bool NeedsDressing(DefCatalog catalog, Roster roster, ApplicantPool? pool)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(catalog);
|
||||
foreach (var person in roster.People)
|
||||
{
|
||||
if (person.Items.Count == 0)
|
||||
if (person.Items.Count == 0 || !ItemsUsable(catalog, person.Items))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -147,7 +148,7 @@ public static class DressGenerator
|
||||
|
||||
foreach (var applicant in pool.Applicants)
|
||||
{
|
||||
if (applicant.Person.Items.Count == 0)
|
||||
if (applicant.Person.Items.Count == 0 || !ItemsUsable(catalog, applicant.Person.Items))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -156,6 +157,19 @@ public static class DressGenerator
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool ItemsUsable(DefCatalog catalog, IReadOnlyList<InventoryItem> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (!catalog.Things.TryGetValue(item.Def, out var def) || def.Abstract)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds textbooks for subjects the pupil just became old enough for. Existing clothes stay.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user