public static void DebugLogPossiblePodContentsDefs() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("ThingDefs that can go in the resource pod crash incident."); foreach (ThingDef item in ItemCollectionGenerator_ResourcePod.PossiblePodContentsDefs()) { stringBuilder.AppendLine(item.defName); } Log.Message(stringBuilder.ToString()); }
private static ThingDef RandomPodContentsDef() { int numMeats = (from x in ItemCollectionGenerator_ResourcePod.PossiblePodContentsDefs() where x.IsMeat select x).Count(); int numLeathers = (from x in ItemCollectionGenerator_ResourcePod.PossiblePodContentsDefs() where x.IsLeather select x).Count(); return(ItemCollectionGenerator_ResourcePod.PossiblePodContentsDefs().RandomElementByWeight((ThingDef d) => ItemCollectionGeneratorUtility.AdjustedSelectionWeight(d, numMeats, numLeathers))); }