示例#1
0
 private void OrderVerbForceTarget()
 {
     if (this.targetingVerb.CasterIsPawn)
     {
         this.OrderPawnForceTarget(this.targetingVerb);
         for (int i = 0; i < this.targetingVerbAdditionalPawns.Count; i++)
         {
             Verb verb = this.GetTargetingVerb(this.targetingVerbAdditionalPawns[i]);
             if (verb != null)
             {
                 this.OrderPawnForceTarget(verb);
             }
         }
     }
     else
     {
         int           numSelected     = Find.Selector.NumSelected;
         List <object> selectedObjects = Find.Selector.SelectedObjects;
         for (int j = 0; j < numSelected; j++)
         {
             Building_Turret building_Turret = selectedObjects[j] as Building_Turret;
             if (building_Turret != null && building_Turret.Map == Find.CurrentMap)
             {
                 LocalTargetInfo targ = this.CurrentTargetUnderMouse(true);
                 building_Turret.OrderAttack(targ);
             }
         }
     }
 }
示例#2
0
        private void OrderVerbForceTarget()
        {
            if (targetingSource.CasterIsPawn)
            {
                OrderPawnForceTarget(targetingSource);
                for (int i = 0; i < targetingSourceAdditionalPawns.Count; i++)
                {
                    Verb targetingVerb = GetTargetingVerb(targetingSourceAdditionalPawns[i]);
                    if (targetingVerb != null)
                    {
                        OrderPawnForceTarget(targetingVerb);
                    }
                }
                return;
            }
            int           numSelected     = Find.Selector.NumSelected;
            List <object> selectedObjects = Find.Selector.SelectedObjects;

            for (int j = 0; j < numSelected; j++)
            {
                Building_Turret building_Turret = selectedObjects[j] as Building_Turret;
                if (building_Turret != null && building_Turret.Map == Find.CurrentMap)
                {
                    LocalTargetInfo targ = CurrentTargetUnderMouse(mustBeHittableNowIfNotMelee: true);
                    building_Turret.OrderAttack(targ);
                }
            }
        }
示例#3
0
 public TurretTop(Building_Turret ParentTurret)
 {
     parentTurret = ParentTurret;
 }
示例#4
0
 public override void TickRare()
 {
     base.TickRare();
     this.SpreadTick--;
     if (this.growthPercent >= 1)
     {
         //check things in cell and react
         CheckThings(Position);
     }
     if (this.SpreadTick == 0)
     {
         //Pick a random direction cell
         IntVec3 dir = new IntVec3();
         dir = GenAdj.RandomAdjSquareCardinal(Position);
         //If in bounds
         if (dir.InBounds())
         {
             //If we find a tasty floor lets eat it nomnomnom
             TerrainDef terrain = dir.GetTerrain();
             if (terrain != null)
             {
                 //Only eat floor if not natural
                 if (terrain.defName != "Sand" &&
                     terrain.defName != "Soil" &&
                     terrain.defName != "MarshyTerrain" &&
                     terrain.defName != "SoilRich" &&
                     terrain.defName != "Mud" &&
                     terrain.defName != "Marsh" &&
                     terrain.defName != "Gravel" &&
                     terrain.defName != "RoughStone" &&
                     terrain.defName != "WaterDeep" &&
                     terrain.defName != "WaterShallow" &&
                     terrain.defName != "RoughHewnRock")
                 {
                     //And by eat i mean replace - TODO can you damage floors over time?
                     //Replace with soil - TODO for now, maybe change to regen tile later if possible
                     Find.TerrainGrid.SetTerrain(dir, TerrainDef.Named("Soil"));
                     //if theres no ivy here
                     if (!IvyInCell(dir))
                     {
                         if (dir.GetPlant() == null)
                         {
                             //no plant, move on
                         }
                         else
                         {
                             //Found plant, Kill it
                             Plant plant = dir.GetPlant();
                             plant.Destroy();
                         }
                         //Spawn more Ivy
                         SpawnIvy(dir);
                     }
                 }
                 //Its natural floor
                 else if (terrain.defName != "WaterDeep" &&
                          terrain.defName != "WaterShallow" &&
                          terrain.defName != "MarshyTerrain")
                 {
                     //if theres no ivy here
                     if (!IvyInCell(dir))
                     {
                         if (dir.GetPlant() == null)
                         {
                             //no plant, move on
                         }
                         else
                         {
                             //Found plant, Kill it
                             Plant plant = dir.GetPlant();
                             plant.Destroy();
                         }
                         //Spawn more Ivy
                         SpawnIvy(dir);
                     }
                 }
                 //its water or something I dont know of
                 else
                 {
                 }
             }
         }
         SpreadTick = OrigSpreadTick;
     }
     if (this.MutateTry == true)
     {
         Random random     = new Random();
         int    MutateRate = random.Next(1, 200);
         if (MutateRate == 3 || MutateRate == 23)
         {
             Building_GasPump GasPump = (Building_GasPump)ThingMaker.MakeThing(ThingDef.Named("GasPump"));
             GasPump.SetFactionDirect(factionDirect);
             if (hasNoBuildings(Position))
             {
                 GenSpawn.Spawn(GasPump, Position);
             }
             this.MutateTry = false;
             //Find.History.AddGameEvent("Gas here", GameEventType.BadNonUrgent, true, Position, string.Empty);
         }
         else if (MutateRate == 4 || MutateRate == 24)
         {
             Building_EggSac EggSac = (Building_EggSac)ThingMaker.MakeThing(ThingDef.Named("EggSac"));
             EggSac.SetFactionDirect(factionDirect);
             if (hasNoBuildings(Position))
             {
                 GenSpawn.Spawn(EggSac, Position);
             }
             this.MutateTry = false;
             //Find.History.AddGameEvent("Egg here", GameEventType.BadNonUrgent, true, Position, string.Empty);
         }
         else if (MutateRate == 5)
         {
             Building_Turret GenMortar = (Building_Turret)ThingMaker.MakeThing(ThingDef.Named("Turret_GenMortarSeed"));
             GenMortar.SetFactionDirect(factionDirect);
             if (hasNoBuildings(Position))
             {
                 GenSpawn.Spawn(GenMortar, Position);
             }
             this.MutateTry = false;
             //Find.History.AddGameEvent("Mortar here", GameEventType.BadNonUrgent, true, Position, string.Empty);
         }
         else if (MutateRate == 6)
         {
             Building_Turret GenTurret = (Building_Turret)ThingMaker.MakeThing(ThingDef.Named("GenTurretBase"));
             GenTurret.SetFactionDirect(factionDirect);
             if (hasNoBuildings(Position))
             {
                 GenSpawn.Spawn(GenTurret, Position);
             }
             this.MutateTry = false;
             //Find.History.AddGameEvent("Turret here", GameEventType.BadNonUrgent, true, Position, string.Empty);
         }
         else
         {
             this.MutateTry = false;
         }
     }
     if (stuckPawn != null)
     {
         int        damageAmountBase = 1;
         DamageInfo damageInfo       = new DamageInfo(this.dmgdef, damageAmountBase, this, null, null);
         stuckPawn.TakeDamage(damageInfo);
         stuckPawn = null;
     }
     if (stuckCorpse != null)
     {
         stuckCorpse.Destroy();
         stuckCorpse = null;
     }
 }