public static void DumpProps(this HediffComp_RandySpawner comp) { Tools.Warn( "hungerRelative: " + comp.Props.hungerRelative + "; " + "healthRelative: " + comp.Props.healthRelative + "; " , comp.MyDebug); for (int i = 0; i < comp.Props.itemParameters.Count; i++) { ItemParameter IP = comp.Props.itemParameters[i]; IP.LogParams(comp.MyDebug); } }
public static void CheckProps(this HediffComp_RandySpawner comp) { if (comp.Props.itemParameters.NullOrEmpty()) { comp.BlockAndDestroy(comp.Pawn.Label + " props: no itemParameters - giving up", comp.MyDebug); } // Logical checks for (int i = 0; i < comp.Props.itemParameters.Count; i++) { ItemParameter IP = comp.Props.itemParameters[i]; if (IP.spawnCount.min > comp.spawnCountErrorLimit || IP.spawnCount.max > comp.spawnCountErrorLimit) { comp.BlockAndDestroy(comp.Pawn.Label + " props: SpawnCount is too high: >" + comp.spawnCountErrorLimit, comp.MyDebug); return; } if (IP.daysB4Next.min < comp.minDaysB4NextErrorLimit) { comp.BlockAndDestroy(comp.Pawn.Label + " props: minDaysB4Next is too low: " + IP.daysB4Next.min + "<" + comp.minDaysB4NextErrorLimit, comp.MyDebug); return; } if (!IP.ThingSpawner && !IP.PawnSpawner) { comp.BlockAndDestroy(comp.Pawn.Label + " props: not a thing nor pawn spawner bc no def for either", comp.MyDebug); return; } if (IP.HasFactionParams) { foreach (RandomFactionParameter FRP in IP.randomFactionParameters) { if (!FRP.IsLegitRandomFactionParameter()) { comp.BlockAndDestroy(comp.Pawn.Label + " faction props: invalid faction params", comp.MyDebug); return; } } } } }