Пример #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);
        }
Пример #3
0
        private static void PodContentsPossibleDefs()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("ThingDefs that can go in the resource pod crash incident.");
            foreach (ThingDef current in ThingSetMaker_ResourcePod.PossiblePodContentsDefs())
            {
                stringBuilder.AppendLine(current.defName);
            }
            Log.Message(stringBuilder.ToString(), false);
        }
Пример #4
0
        private static ThingDef RandomPodContentsDef()
        {
            int numMeats = (from x in ThingSetMaker_ResourcePod.PossiblePodContentsDefs()
                            where x.IsMeat
                            select x).Count <ThingDef>();
            int numLeathers = (from x in ThingSetMaker_ResourcePod.PossiblePodContentsDefs()
                               where x.IsLeather
                               select x).Count <ThingDef>();

            return(ThingSetMaker_ResourcePod.PossiblePodContentsDefs().RandomElementByWeight((ThingDef d) => ThingSetMakerUtility.AdjustedBigCategoriesSelectionWeight(d, numMeats, numLeathers)));
        }
Пример #5
0
 protected override IEnumerable <ThingDef> AllGeneratableThingsDebugSub(ThingSetMakerParams parms)
 {
     return(ThingSetMaker_ResourcePod.PossiblePodContentsDefs());
 }