Skip to content

Commit

Permalink
Added ideology color to apparel color swatches
Browse files Browse the repository at this point in the history
  • Loading branch information
edbmods committed Aug 15, 2021
1 parent 92d902b commit b4c14f3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
16 changes: 16 additions & 0 deletions Source/CustomPawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,22 @@ public Gender Gender {
}
}

public Color? FavoriteColor {
get {
if (ModsConfig.IdeologyActive) {
return Pawn.story.favoriteColor;
}
else {
return null;
}
}
set {
if (ModsConfig.IdeologyActive) {
Pawn.story.favoriteColor = value;
}
}
}

public Color SkinColor {
get {
return pawn.story.SkinColor;
Expand Down
20 changes: 16 additions & 4 deletions Source/PanelAppearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,29 @@ protected void DrawColorSelectorForApparelStuff(CustomPawn customPawn, float cur
}

public IEnumerable<Color> PrependFavoriteAndIdeologyColors(Color? color) {
if (currentPawn.Pawn.story.favoriteColor.HasValue) {
yield return currentPawn.Pawn.story.favoriteColor.Value;
if (currentPawn.FavoriteColor.HasValue) {
yield return currentPawn.FavoriteColor.Value;
}
if (ModsConfig.IdeologyActive) {
Color? ideoColor = currentPawn.Pawn?.ideo?.Ideo.ApparelColor;
if (ideoColor.HasValue) {
yield return ideoColor.Value;
}
}
if (color.HasValue) {
yield return color.Value;
}
}

public IEnumerable<Color> PrependFavoriteAndIdeologyColors(IEnumerable<Color> colors) {
if (currentPawn.Pawn.story.favoriteColor.HasValue) {
yield return currentPawn.Pawn.story.favoriteColor.Value;
if (currentPawn.FavoriteColor.HasValue) {
yield return currentPawn.FavoriteColor.Value;
}
if (ModsConfig.IdeologyActive) {
Color? ideoColor = currentPawn.Pawn?.ideo?.Ideo.ApparelColor;
if (ideoColor.HasValue) {
yield return ideoColor.Value;
}
}
if (colors != null) {
foreach (var color in colors) {
Expand Down

0 comments on commit b4c14f3

Please sign in to comment.