From e98342bd01794bc110bb166478cde6c846d2d831 Mon Sep 17 00:00:00 2001 From: Sn1p3rr3c0n Date: Fri, 11 Mar 2022 20:15:40 +0100 Subject: [PATCH] #567 added regex check to not match unintended recipies --- Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs b/Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs index e1af46f5..16c42de2 100644 --- a/Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs +++ b/Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Xml.Serialization; using RimWorld; @@ -273,12 +273,14 @@ private static List CostListCopy(List da /// private static void removeComponents(List defNames) { + Regex checkRecipeLable = new Regex(@"^.+? x\d+$", RegexOptions.Compiled); Dictionary> replacementDict = new Dictionary>(); List recipeDefs2 = DefDatabase.AllDefsListForReading.Where(d => d.products.Select(s => s.thingDef).ToList().Where(c => defNames.Contains(c.defName)).Any()).ToList(); foreach (RecipeDef def in recipeDefs2) { + if (checkRecipeLable.IsMatch(def.label)) continue; replacementDict.Add(def.ProducedThingDef, def.ingredients); }