Example #1
0
 public override void Tick()
 {
     base.Tick();
     start--;
     if (start == 0)
     {
         armed         = true;
         this.armedgfc = new Graphic_Single(MaterialPool.MatFrom("Things/Weapons/APM_armed", true));
     }
     if (armed == true)
     {
         delay--;
         if (delay == 1)
         {
             foreach (IntVec3 current in GenAdj.AdjacentSquaresCardinal(this))
             {
                 foreach (Thing thing in Find.ThingGrid.ThingsAt(current))
                 {
                     if (thing is Pawn)
                     {
                         this.Command_Detonate();
                         delay = 30;
                     }
                 }
             }
         }
         else if (delay == 0)
         {
             delay = 30;
         }
     }
 }
Example #2
0
 public override void Tick()
 {
     base.Tick();
     spawnticks--;
     if (spawnticks == 0)
     {
         foreach (IntVec3 current in GenAdj.AdjacentSquaresCardinal(this))
         {
             if (current.GetPlant() == null)
             {
                 //not a plant, spawn ivy
                 Plant newivy = (Plant)ThingMaker.MakeThing(ThingDef.Named("PurpleIvy"));
                 GenSpawn.Spawn(newivy, current);
             }
             else
             {
                 Plant plant = current.GetPlant();
                 if (plant.def.defName != "PurpleIvy")
                 {
                     plant.Destroy();
                     Plant newivy = (Plant)ThingMaker.MakeThing(ThingDef.Named("PurpleIvy"));
                     GenSpawn.Spawn(newivy, current);
                 }
                 else
                 {
                     //dont destroy other ivy
                 }
             }
         }
         spawnticks = 1200;
     }
 }