Beispiel #1
0
 public override void OnActivated()
 {
     base.OnActivated();
     Find.TutorialState.sandbagsRect = TutorUtility.FindUsableRect(7, 7, base.Map, 0f, false);
     this.sandbagCells = new List <IntVec3>();
     foreach (IntVec3 item in Find.TutorialState.sandbagsRect.EdgeCells)
     {
         if (item.x != Find.TutorialState.sandbagsRect.CenterCell.x && item.z != Find.TutorialState.sandbagsRect.CenterCell.z)
         {
             this.sandbagCells.Add(item);
         }
     }
     foreach (IntVec3 c in Find.TutorialState.sandbagsRect.ContractedBy(1))
     {
         if (!Find.TutorialState.sandbagsRect.ContractedBy(2).Contains(c))
         {
             List <Thing> thingList = c.GetThingList(base.Map);
             for (int i = thingList.Count - 1; i >= 0; i--)
             {
                 Thing thing = thingList[i];
                 if (thing.def.passability != Traversability.Standable && (thing.def.category == ThingCategory.Plant || thing.def.category == ThingCategory.Item))
                 {
                     thing.Destroy(DestroyMode.Vanish);
                 }
             }
         }
     }
 }
 public override void OnActivated()
 {
     base.OnActivated();
     Find.TutorialState.sandbagsRect = TutorUtility.FindUsableRect(7, 7, base.Map);
     sandbagCells = new List <IntVec3>();
     foreach (IntVec3 edgeCell in Find.TutorialState.sandbagsRect.EdgeCells)
     {
         if (edgeCell.x != Find.TutorialState.sandbagsRect.CenterCell.x && edgeCell.z != Find.TutorialState.sandbagsRect.CenterCell.z)
         {
             sandbagCells.Add(edgeCell);
         }
     }
     foreach (IntVec3 item in Find.TutorialState.sandbagsRect.ContractedBy(1))
     {
         if (!Find.TutorialState.sandbagsRect.ContractedBy(2).Contains(item))
         {
             List <Thing> thingList = item.GetThingList(base.Map);
             for (int num = thingList.Count - 1; num >= 0; num--)
             {
                 Thing thing = thingList[num];
                 if (thing.def.passability != 0 && (thing.def.category == ThingCategory.Plant || thing.def.category == ThingCategory.Item))
                 {
                     thing.Destroy();
                 }
             }
         }
     }
 }
Beispiel #3
0
        public override void OnActivated()
        {
            base.OnActivated();
            CellRect cellRect = TutorUtility.FindUsableRect(10, 10, base.Map, 0f, noItems: true);
            GenStep_ScatterLumpsMineable genStep_ScatterLumpsMineable = new GenStep_ScatterLumpsMineable();

            genStep_ScatterLumpsMineable.forcedDefToScatter = ThingDefOf.MineableSteel;
            genStep_ScatterLumpsMineable.ForceScatterAt(cellRect.CenterCell, base.Map);
            mineCells = new List <IntVec3>();
            foreach (IntVec3 item in cellRect)
            {
                Building edifice = item.GetEdifice(base.Map);
                if (edifice != null && edifice.def == ThingDefOf.MineableSteel)
                {
                    mineCells.Add(item);
                }
            }
        }
Beispiel #4
0
        public override void OnActivated()
        {
            base.OnActivated();
            CellRect cellRect = TutorUtility.FindUsableRect(10, 10, base.Map, 0f, true);

            new GenStep_ScatterLumpsMineable
            {
                forcedDefToScatter = ThingDefOf.MineableSteel
            }.ForceScatterAt(cellRect.CenterCell, base.Map);
            this.mineCells = new List <IntVec3>();
            foreach (IntVec3 intVec in cellRect)
            {
                Building edifice = intVec.GetEdifice(base.Map);
                if (edifice != null && edifice.def == ThingDefOf.MineableSteel)
                {
                    this.mineCells.Add(intVec);
                }
            }
        }
Beispiel #5
0
 public override void OnActivated()
 {
     base.OnActivated();
     if (def.giveOnActivateCount > 0)
     {
         Thing thing = ThingMaker.MakeThing(def.giveOnActivateDef);
         thing.stackCount = def.giveOnActivateCount;
         GenSpawn.Spawn(thing, TutorUtility.FindUsableRect(2, 2, Map).CenterCell, Map);
     }
     if (def.resetBuildDesignatorStuffs)
     {
         foreach (DesignationCategoryDef allDef in DefDatabase <DesignationCategoryDef> .AllDefs)
         {
             foreach (Designator resolvedAllowedDesignator in allDef.ResolvedAllowedDesignators)
             {
                 (resolvedAllowedDesignator as Designator_Build)?.ResetStuffToDefault();
             }
         }
     }
 }
Beispiel #6
0
 public override void OnActivated()
 {
     base.OnActivated();
     if (this.def.giveOnActivateCount > 0)
     {
         Thing thing = ThingMaker.MakeThing(this.def.giveOnActivateDef, null);
         thing.stackCount = this.def.giveOnActivateCount;
         GenSpawn.Spawn(thing, TutorUtility.FindUsableRect(2, 2, this.Map, 0f, false).CenterCell, this.Map, WipeMode.Vanish);
     }
     if (this.def.resetBuildDesignatorStuffs)
     {
         foreach (DesignationCategoryDef current in DefDatabase <DesignationCategoryDef> .AllDefs)
         {
             foreach (Designator current2 in current.ResolvedAllowedDesignators)
             {
                 Designator_Build designator_Build = current2 as Designator_Build;
                 if (designator_Build != null)
                 {
                     designator_Build.ResetStuffToDefault();
                 }
             }
         }
     }
 }
		public override void OnActivated()
		{
			base.OnActivated();
			Find.TutorialState.sandbagsRect = TutorUtility.FindUsableRect(7, 7, base.Map, 0f, false);
			this.sandbagCells = new List<IntVec3>();
			foreach (IntVec3 edgeCell in Find.TutorialState.sandbagsRect.EdgeCells)
			{
				IntVec3 current = edgeCell;
				int x = current.x;
				IntVec3 centerCell = Find.TutorialState.sandbagsRect.CenterCell;
				if (x != centerCell.x)
				{
					int z = current.z;
					IntVec3 centerCell2 = Find.TutorialState.sandbagsRect.CenterCell;
					if (z != centerCell2.z)
					{
						this.sandbagCells.Add(current);
					}
				}
			}
			foreach (IntVec3 item in Find.TutorialState.sandbagsRect.ContractedBy(1))
			{
				if (!Find.TutorialState.sandbagsRect.ContractedBy(2).Contains(item))
				{
					List<Thing> thingList = item.GetThingList(base.Map);
					for (int num = thingList.Count - 1; num >= 0; num--)
					{
						Thing thing = thingList[num];
						if (thing.def.passability != 0 && (thing.def.category == ThingCategory.Plant || thing.def.category == ThingCategory.Item))
						{
							thing.Destroy(DestroyMode.Vanish);
						}
					}
				}
			}
		}
 public override void OnActivated()
 {
     base.OnActivated();
     this.growingZoneRect = TutorUtility.FindUsableRect(10, 8, base.Map, 0.5f, false);
     this.RecacheCells();
 }
 public override void OnActivated()
 {
     base.OnActivated();
     this.RoomRect = TutorUtility.FindUsableRect(12, 8, base.Map, 0f, false);
 }
 public override void OnActivated()
 {
     base.OnActivated();
     this.stockpileRect = TutorUtility.FindUsableRect(6, 6, base.Map, 0f, false);
     this.RecacheCells();
 }
 public override void OnActivated()
 {
     base.OnActivated();
     stockpileRect = TutorUtility.FindUsableRect(6, 6, base.Map);
     RecacheCells();
 }
Beispiel #12
0
 public override void OnActivated()
 {
     base.OnActivated();
     RoomRect = TutorUtility.FindUsableRect(12, 8, base.Map);
 }