Exemplo n.º 1
0
        public static void DebugSpawn(ThingDef def, IntVec3 c, int stackCount = -1, bool direct = false)
        {
            if (stackCount <= 0)
            {
                stackCount = def.stackLimit;
            }
            ThingDef    stuff       = GenStuff.RandomStuffFor(def);
            Thing       thing       = ThingMaker.MakeThing(def, stuff);
            CompQuality compQuality = thing.TryGetComp <CompQuality>();

            if (compQuality != null)
            {
                compQuality.SetQuality(QualityUtility.RandomQuality(), ArtGenerationContext.Colony);
            }
            if (thing.def.Minifiable)
            {
                thing = thing.MakeMinified();
            }
            thing.stackCount = stackCount;
            if (direct)
            {
                GenPlace.TryPlaceThing(thing, c, Find.VisibleMap, ThingPlaceMode.Direct, null);
            }
            else
            {
                GenPlace.TryPlaceThing(thing, c, Find.VisibleMap, ThingPlaceMode.Near, null);
            }
        }