diff --git a/RJWSexperience/RJWSexperience/Patches/DefInjection.cs b/RJWSexperience/RJWSexperience/Patches/DefInjection.cs index 6562ddc..893fbdd 100644 --- a/RJWSexperience/RJWSexperience/Patches/DefInjection.cs +++ b/RJWSexperience/RJWSexperience/Patches/DefInjection.cs @@ -1,35 +1,29 @@ -using System; +using RJWSexperience.Logs; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Verse; -using HarmonyLib; - namespace RJWSexperience { - [StaticConstructorOnStartup] - public static class DefInjection - { - static DefInjection() - { - InjectRaces(); - } + [StaticConstructorOnStartup] + public static class DefInjection + { + static DefInjection() + { + InjectRaces(); + } - private static void InjectRaces() - { - List PawnDefs = DefDatabase.AllDefs.Where(x => x.race != null && !x.race.IsMechanoid).ToList(); - InjectComp(PawnDefs); - } + private static void InjectRaces() + { + IEnumerable PawnDefs = DefDatabase.AllDefs.Where(x => x.race != null && !x.race.IsMechanoid); + if (PawnDefs.EnumerableNullOrEmpty()) + return; - private static void InjectComp(List PawnDefs) - { - CompProperties comp = new CompProperties(typeof(SexHistoryComp)); - if (!PawnDefs.NullOrEmpty()) foreach(ThingDef def in PawnDefs) - { - def.comps.Add(comp); - } - } - } + CompProperties comp = new CompProperties(typeof(SexHistoryComp)); + foreach (ThingDef def in PawnDefs) + def.comps.Add(comp); + + LogManager.GetLogger("StaticConstructorOnStartup").Message($"Injected SexHistoryComp into {PawnDefs.Count()} pawn Defs"); + } + } }