protected override void Generate(ItemCollectionGeneratorParams parms, List <Thing> outThings) { ThingDef thingDef = ItemCollectionGenerator_ResourcePod.RandomPodContentsDef(); float num = Rand.Range(150f, 600f); while (true) { Thing thing = ThingMaker.MakeThing(thingDef, null); int num2 = Rand.Range(20, 40); if (num2 > thing.def.stackLimit) { num2 = thing.def.stackLimit; } if ((float)num2 * thing.def.BaseMarketValue > num) { num2 = Mathf.FloorToInt(num / thing.def.BaseMarketValue); } if (num2 == 0) { num2 = 1; } thing.stackCount = num2; outThings.Add(thing); num -= (float)num2 * thingDef.BaseMarketValue; if (outThings.Count >= 7) { break; } if (num <= thingDef.BaseMarketValue) { break; } } }
public static void DebugLogPodContentsChoices() { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < 100; i++) { stringBuilder.AppendLine(ItemCollectionGenerator_ResourcePod.RandomPodContentsDef().LabelCap); } Log.Message(stringBuilder.ToString()); }