From d4ad81a4f81c38ed43907a0d1454bb7e3c7ac03f Mon Sep 17 00:00:00 2001 From: Phomor <42185162+Phomor@users.noreply.github.com> Date: Wed, 21 Dec 2022 13:09:34 +0100 Subject: [PATCH] Only block legenary items that were made legendary by the Perfectionist trait. --- .../GenerateQualityCreatedByPawn_Patch.cs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/1.3/Source/VanillaTraitsExpanded/HarmonyPatches/GenerateQualityCreatedByPawn_Patch.cs b/1.3/Source/VanillaTraitsExpanded/HarmonyPatches/GenerateQualityCreatedByPawn_Patch.cs index 4c599be..d434052 100644 --- a/1.3/Source/VanillaTraitsExpanded/HarmonyPatches/GenerateQualityCreatedByPawn_Patch.cs +++ b/1.3/Source/VanillaTraitsExpanded/HarmonyPatches/GenerateQualityCreatedByPawn_Patch.cs @@ -42,23 +42,24 @@ private static void Postfix(ref QualityCategory __result, Pawn pawn, SkillDef re { var newResult = (QualityCategory)((int)__result + 1); __result = newResult; + + if (__result == QualityCategory.Legendary && !__state) + { + if (ModsConfig.IdeologyActive) + { + var role = pawn.Ideo.GetRole(pawn); + if (role != null && role.def.defName == "IdeoRole_ProductionSpecialist") + { + return; // we allow legendary for production specialist + } + } + __result = QualityCategory.Masterwork; + } } if (__result == QualityCategory.Normal || __result == QualityCategory.Awful || __result == QualityCategory.Poor) { pawn.TryGiveThought(VTEDefOf.VTE_CreatedLowQualityItem); } - if (__result == QualityCategory.Legendary && !__state) - { - if (ModsConfig.IdeologyActive) - { - var role = pawn.Ideo.GetRole(pawn); - if (role != null && role.def.defName == "IdeoRole_ProductionSpecialist") - { - return; // we allow legendary for production specialist - } - } - __result = QualityCategory.Masterwork; - } } } }