Exemple #1
0
        private static void ReplaceAllThingsOf()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (Thing t in from kd in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>()
                     orderby kd.def.defName
                     select kd)
            {
                list.Add(new DebugMenuOption(t.def.LabelCap, DebugMenuOptionMode.Action, delegate()
                {
                    List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                    foreach (ThingDef localDef3 in from def in DefDatabase <ThingDef> .AllDefs
                             where DebugThingPlaceHelper.IsDebugSpawnable(def, false)
                             select def)
                    {
                        ThingDef localDef = localDef3;
                        list2.Add(new DebugMenuOption(localDef.LabelCap, DebugMenuOptionMode.Action, delegate()
                        {
                            foreach (Thing thing in Find.CurrentMap.listerThings.AllThings.ToList <Thing>())
                            {
                                if (thing.def == t.def)
                                {
                                    IntVec3 pos = thing.Position;
                                    int count   = thing.stackCount;
                                    thing.Destroy(DestroyMode.Vanish);
                                    DebugThingPlaceHelper.DebugSpawn(localDef, pos, count);
                                }
                            }
                        }));
                        Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
                    }
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
Exemple #2
0
        private static void TryPlaceRandomAffixable()
        {
            ThingDef thingDef = DefDatabase <ThingDef> .AllDefs.RandomElementByWeight(t =>
                                                                                      DebugThingPlaceHelper.IsDebugSpawnable(t, false) && t.HasComp(typeof(CompLootAffixableThing))? 1 : 0
                                                                                      );

            DebugThingPlaceHelper.DebugSpawn(thingDef, UI.MouseCell());
        }
Exemple #3
0
 public void EmptyMailBox()
 {
     if (Items.Count > 0)
     {
         foreach (Thing thing in Items)
         {
             DebugThingPlaceHelper.DebugSpawn(thing.def, parent.Position, thing.stackCount);
         }
         Items.Clear();
     }
 }
Exemple #4
0
        private static void FillWithItems(CellRect rect, List <ThingDef> itemDefs)
        {
            int num = 0;

            foreach (IntVec3 item in rect)
            {
                if (item.x % 6 != 0 && item.z % 6 != 0)
                {
                    DebugThingPlaceHelper.DebugSpawn(itemDefs[num], item, -1, direct: true);
                    num++;
                    if (num >= itemDefs.Count)
                    {
                        num = 0;
                    }
                }
            }
        }
Exemple #5
0
        private static void FillWithItems(CellRect rect, List <ThingDef> itemDefs)
        {
            int num = 0;

            foreach (IntVec3 current in rect)
            {
                if (current.x % 6 != 0 && current.z % 6 != 0)
                {
                    ThingDef def = itemDefs[num];
                    DebugThingPlaceHelper.DebugSpawn(def, current, -1, true);
                    num++;
                    if (num >= itemDefs.Count)
                    {
                        num = 0;
                    }
                }
            }
        }
        private static void FillWithItems(CellRect rect, List <ThingDef> itemDefs)
        {
            int num         = 0;
            int itemCounter = itemDefs.Count;

            foreach (IntVec3 intVec in rect)
            {
                if (intVec.x % 6 != 0 && intVec.z % 6 != 0)
                {
                    DebugThingPlaceHelper.DebugSpawn(itemDefs[num], intVec, -1, true);
                    itemCounter--;
                    num++;
                    if (num >= itemDefs.Count)
                    {
                        num = 0;
                    }
                    if (itemCounter < 0)
                    {
                        break;
                    }
                }
            }
        }