From 1eb3ddb9dabc46649e09cc80924877aad745cd50 Mon Sep 17 00:00:00 2001 From: edbmods Date: Sun, 23 Feb 2020 16:09:25 -0800 Subject: [PATCH 1/2] Added a check for new color generator in the Alien Races mod --- Properties/AssemblyInfo.cs | 2 +- Resources/About/About.xml | 2 +- Resources/About/Manifest.xml | 2 +- Source/Logger.cs | 2 +- Source/ProviderAlienRaces.cs | 36 +++++++++++++++++++----------------- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 7972219..856043f 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -14,4 +14,4 @@ [assembly: AssemblyVersion("1.1.1")] // Increment for each new release -[assembly: AssemblyFileVersion("1.1.1")] +[assembly: AssemblyFileVersion("1.1.2")] diff --git a/Resources/About/About.xml b/Resources/About/About.xml index 231c3e4..ab96255 100644 --- a/Resources/About/About.xml +++ b/Resources/About/About.xml @@ -12,6 +12,6 @@ If you get a set of starting colonists that you like, save them as a preset so that you can start your game the same way next time. -[Version 1.1.1] +[Version 1.1.2] \ No newline at end of file diff --git a/Resources/About/Manifest.xml b/Resources/About/Manifest.xml index 50b81fa..ea1d2db 100644 --- a/Resources/About/Manifest.xml +++ b/Resources/About/Manifest.xml @@ -1,7 +1,7 @@ EdBPrepareCarefully - 1.0.16 + 1.1.2
  • Core
  • HugsLib
  • diff --git a/Source/Logger.cs b/Source/Logger.cs index 3cbd533..e79c963 100644 --- a/Source/Logger.cs +++ b/Source/Logger.cs @@ -3,8 +3,8 @@ namespace EdB.PrepareCarefully { public static class Logger { - private static readonly string Prefix = "[Prepare Carefully] "; private static readonly bool DebugEnabled = false; + private static readonly string Prefix = "[Prepare Carefully] "; public static void Debug(string message) { if (DebugEnabled) { diff --git a/Source/ProviderAlienRaces.cs b/Source/ProviderAlienRaces.cs index fb10b44..c398992 100644 --- a/Source/ProviderAlienRaces.cs +++ b/Source/ProviderAlienRaces.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System; using System.Collections.Generic; using System.Linq; @@ -174,22 +174,24 @@ protected AlienRace InitializeAlienRace(ThingDef raceDef) { object primaryColorGeneratorValue = GetFieldValue(raceDef, alienPartGeneratorObject, "alienskincolorgen", true); result.UseMelaninLevels = true; ColorGenerator primaryGenerator = primaryColorGeneratorValue as ColorGenerator; - if (primaryGenerator != null) { - result.UseMelaninLevels = false; - result.PrimaryColors = primaryGenerator.GetColorList(); - } - else { - result.PrimaryColors = new List(); - } - object secondaryColorGeneratorValue = GetFieldValue(raceDef, alienPartGeneratorObject, "alienskinsecondcolorgen", true); - result.HasSecondaryColor = false; - ColorGenerator secondaryGenerator = secondaryColorGeneratorValue as ColorGenerator; - if (secondaryGenerator != null) { - result.HasSecondaryColor = true; - result.SecondaryColors = secondaryGenerator.GetColorList(); - } - else { - result.SecondaryColors = new List(); + if (primaryGenerator.GetType().Name != "ColorGenerator_SkinColorMelanin") { + if (primaryGenerator != null) { + result.UseMelaninLevels = false; + result.PrimaryColors = primaryGenerator.GetColorList(); + } + else { + result.PrimaryColors = new List(); + } + object secondaryColorGeneratorValue = GetFieldValue(raceDef, alienPartGeneratorObject, "alienskinsecondcolorgen", true); + result.HasSecondaryColor = false; + ColorGenerator secondaryGenerator = secondaryColorGeneratorValue as ColorGenerator; + if (secondaryGenerator != null) { + result.HasSecondaryColor = true; + result.SecondaryColors = secondaryGenerator.GetColorList(); + } + else { + result.SecondaryColors = new List(); + } } // Hair properties. From 36d5e2ac938c8a459265eba9cbbd12348b047535 Mon Sep 17 00:00:00 2001 From: edbmods Date: Sun, 23 Feb 2020 16:25:05 -0800 Subject: [PATCH 2/2] Fixed a bug with health option sorting code triggered when using the Genetic Rim mod --- Source/OptionsHealth.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/OptionsHealth.cs b/Source/OptionsHealth.cs index bf22f89..30417fc 100644 --- a/Source/OptionsHealth.cs +++ b/Source/OptionsHealth.cs @@ -157,11 +157,17 @@ public List ImplantRecipes { } } public void Sort() { + SortImplants(); + SortInjuries(); + } + protected void SortImplants() { implantRecipes.Sort((RecipeDef a, RecipeDef b) => { - return a.LabelCap.Resolve().CompareTo(b.LabelCap); + return string.Compare(a.LabelCap.Resolve(), b.LabelCap.Resolve()); }); + } + protected void SortInjuries() { injuryOptions.Sort((InjuryOption a, InjuryOption b) => { - return a.Label.CompareTo(b.Label); + return string.Compare(a.Label, b.Label); }); } public void AddInjury(InjuryOption option) {