Enhance apparel definitions: Introduce 'UpperUnderwear' layer and related items (Bra, SportsBra, SoftBra) to support gender-specific clothing. Update inventory and dress generation logic to accommodate new layers and ensure proper coverage. Adjust localization for new apparel terms and refine tests for underwear functionality.

This commit is contained in:
Leonid Pershin
2026-08-20 07:20:40 +03:00
parent 2af85e1c41
commit 660340c216
24 changed files with 527 additions and 108 deletions
@@ -115,6 +115,45 @@ public class ApparelDefTests
Assert.Equal([ColorTags.Bright], catalog.Colors["Red"].Tags);
}
[Fact]
public void BraInheritsFromUnderwear_ButOccupiesUpperUnderwear()
{
var catalog = _loader.Load(
[CatalogLoader.CorePackId],
[
PackDocuments.Def(
CatalogLoader.CorePackId,
"colors",
"white",
"""{ "defName": "White", "tags": ["neutral"] }"""),
PackDocuments.Def(
CatalogLoader.CorePackId,
"things",
"underwear",
"""{ "defName": "Underwear", "abstract": true, "layers": ["Underwear"], "portable": true, "mass": 0.05, "colors": ["White"] }"""),
PackDocuments.Def(
CatalogLoader.CorePackId,
"things",
"bra",
"""{ "defName": "Bra", "parent": "Underwear", "layers": ["UpperUnderwear"], "sex": "female" }"""),
PackDocuments.Def(
CatalogLoader.CorePackId,
"things",
"panties",
"""{ "defName": "Panties", "parent": "Underwear", "sex": "female" }"""),
]);
Assert.True(catalog.Things["Underwear"].Abstract);
Assert.False(catalog.Things["Bra"].Abstract);
Assert.Equal("Underwear", catalog.Things["Bra"].Parent);
Assert.Equal([ApparelLayers.UpperUnderwear], catalog.Things["Bra"].Layers);
Assert.True(catalog.Things["Bra"].Portable);
Assert.Equal(0.05f, catalog.Things["Bra"].Mass);
Assert.Equal(["White"], catalog.Things["Bra"].Colors);
Assert.Equal([ApparelLayers.Underwear], catalog.Things["Panties"].Layers);
Assert.Equal("female", catalog.Things["Panties"].Sex);
}
[Fact]
public void TShirtReferencingMissingRed_FailsTheCatalog()
{
@@ -41,6 +41,15 @@ public class VanillaCoreTests
Assert.False(catalog.Things["Chair"].Portable);
Assert.Empty(catalog.Things["StudentDesk"].Layers);
Assert.Equal([ApparelLayers.Bottom, ApparelLayers.Top], catalog.Things["Dress"].Layers);
Assert.True(catalog.Things["Underwear"].Abstract);
Assert.Equal("Underwear", catalog.Things["Panties"].Parent);
Assert.Equal("Underwear", catalog.Things["Bra"].Parent);
Assert.Equal([ApparelLayers.Underwear], catalog.Things["Panties"].Layers);
Assert.Equal([ApparelLayers.UpperUnderwear], catalog.Things["Bra"].Layers);
Assert.Equal("female", catalog.Things["Bra"].Sex);
Assert.Equal(11, catalog.Things["Bra"].Age?.Min);
Assert.Contains(ApparelLayers.UpperUnderwear, catalog.Things["Shirt"].FullyCoversLayers);
Assert.DoesNotContain(ApparelLayers.UpperUnderwear, catalog.Things["Pants"].FullyCoversLayers);
Assert.Contains("Red", catalog.Things["TShirt"].Colors);
Assert.True(catalog.Things["PeShirt"].Pe);
Assert.True(catalog.Things["Textbook"].Portable);