Add skin color gene handling to PawnAppearanceData and update skin tone description logic. Enhance AIImages.dll to support special skin tones based on gene definitions, improving character appearance representation.
All checks were successful
SonarQube Analysis / Build and analyze (push) Successful in 1m57s
All checks were successful
SonarQube Analysis / Build and analyze (push) Successful in 1m57s
This commit is contained in:
@@ -29,6 +29,20 @@ namespace AIImages.Services
|
||||
HairColor = pawn.story.HairColor,
|
||||
};
|
||||
|
||||
// Извлекаем гены цвета кожи
|
||||
if (pawn.genes?.GenesListForReading != null)
|
||||
{
|
||||
var skinColorGenes = pawn
|
||||
.genes.GenesListForReading
|
||||
.Where(gene => gene.Active && IsSkinColorGene(gene.def))
|
||||
.ToList();
|
||||
|
||||
foreach (var gene in skinColorGenes)
|
||||
{
|
||||
data.SkinColorGeneDefNames.Add(gene.def.defName);
|
||||
}
|
||||
}
|
||||
|
||||
// Извлекаем черты характера
|
||||
if (pawn.story.traits?.allTraits != null)
|
||||
{
|
||||
@@ -180,5 +194,19 @@ namespace AIImages.Services
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверяет, является ли ген геном цвета кожи
|
||||
/// </summary>
|
||||
private bool IsSkinColorGene(GeneDef geneDef)
|
||||
{
|
||||
if (geneDef == null)
|
||||
return false;
|
||||
|
||||
string geneDefName = geneDef.defName;
|
||||
return geneDefName.StartsWith("Skin_")
|
||||
|| geneDefName.Contains("SkinColor")
|
||||
|| geneDefName.Contains("SkinTone");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user