Skip to content

Commit

Permalink
Prevent exception when converting baldness (#1551) #patch
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains authored Oct 7, 2023
1 parent 7bb73ee commit 5857d05
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ImperatorToCK3/CK3/Characters/DNAFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ public DNA GenerateDNA(Imperator.Characters.Character irCharacter, PortraitData
};
// CK3 does not seem to actually support baldness (as of CK3 1.8.1) despite the gene being there.
// So we just remove the hair.
accessoryDNAValues["hairstyles"] = accessoryDNAValues["hairstyles"] with {
TemplateName = "no_hairstyles", IntSliderValue = 0
};
if (accessoryDNAValues.TryGetValue("hairstyles", out var hairstylesGeneValue)) {
accessoryDNAValues["hairstyles"] = hairstylesGeneValue with {
TemplateName = "no_hairstyles", IntSliderValue = 0
};
}
} else {
morphDNAValues["gene_baldness"] = new DNAGeneValue {
TemplateName = "no_baldness",
Expand Down

0 comments on commit 5857d05

Please sign in to comment.