Пример #1
0
        protected override void Generate(ThingSetMakerParams parms, List <Thing> outThings)
        {
            ThingDef thingDef = ThingSetMaker_ResourcePod.RandomPodContentsDef();
            float    num      = Rand.Range(150f, 600f);

            do
            {
                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;
            }while (outThings.Count < 7 && num > thingDef.BaseMarketValue);
        }
Пример #2
0
        private static void PodContentsTest()
        {
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 0; i < 100; i++)
            {
                stringBuilder.AppendLine(ThingSetMaker_ResourcePod.RandomPodContentsDef().LabelCap);
            }
            Log.Message(stringBuilder.ToString(), false);
        }