Skip to content

Commit

Permalink
Merge pull request #572 from zymex22/issue567
Browse files Browse the repository at this point in the history
#567 added regex check to not match unintended recipies
  • Loading branch information
Sn1p3rr3c0n authored Apr 26, 2022
2 parents 7955039 + e98342b commit ae150bf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -273,12 +273,14 @@ private static List<ThingDefCountClass> CostListCopy(List<ThingDefCountClass> da
/// <param name="defNames"></param>
private static void removeComponents(List<string> defNames)
{
Regex checkRecipeLable = new Regex(@"^.+? x\d+$", RegexOptions.Compiled);

Dictionary<ThingDef, List<IngredientCount>> replacementDict = new Dictionary<ThingDef, List<IngredientCount>>();

List<RecipeDef> recipeDefs2 = DefDatabase<RecipeDef>.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);
}

Expand Down

0 comments on commit ae150bf

Please sign in to comment.