Example #1
0
        private void SpawnShips()
        {
            World w = ServerCore.GetServerCore().GetWorld();

            if (faction == Faction.Enemy)
            {
                if (spawnerType == SpawnerType.Easy)
                {
                    for (int i = 0; i < maxShips; i++)
                    {
                        Vector2 rndVector = new Vector2(core.random.Next(-500, 500), core.random.Next(-500, 500)) + Position;
                        int[]   comp      = { 1, 1, 0, 0, 0, 0, 0 };
                        //r e s a a a a;
                        ShipNPC   s  = new ShipNPC(rndVector, rndVector, faction, ShipType.EnemySmall1, comp, w, AiSearchType.Around, AiAgressiveType.Attack);
                        GunSlot[] gs = { new GunSlot(GunType.LaserSmall, s), new GunSlot(GunType.LaserSmall, s) };
                        s.AddGuns(gs);
                        s.cargoSize = s.maxCargoSize;
                        s.crewSize  = s.maxCrewSize;
                        s.shipName  = "<BOT> Saimon";
                        s.id        = w.GetNpcId();
                        ships.Add(s);
                        w.shipsNpc.Add(s);
                        ServerPacketSender.SendCreateNpcShip(s);
                    }
                }
            }
            else if (faction == Faction.Human)
            {
                if (spawnerType == SpawnerType.Easy)
                {
                    for (int i = 0; i < maxShips; i++)
                    {
                        Vector2 rndVector = new Vector2(core.random.Next(-500, 500), core.random.Next(-500, 500)) + Position;
                        int[]   comp      = { 1, 1, 0, 0, 0, 0, 0 };
                        //r e s a a a a;
                        ShipNPC   s  = new ShipNPC(rndVector, rndVector, faction, ShipType.HumanSmall1, comp, w, AiSearchType.Around, AiAgressiveType.Attack);
                        GunSlot[] gs = { new GunSlot(GunType.PlasmSmall, s), new GunSlot(GunType.PlasmSmall, s) };
                        s.AddGuns(gs);
                        s.cargoSize = s.maxCargoSize;
                        s.crewSize  = s.maxCrewSize;
                        s.shipName  = "<BOT> Human";
                        s.id        = w.GetNpcId();
                        ships.Add(s);
                        w.shipsNpc.Add(s);
                        ServerPacketSender.SendCreateNpcShip(s);
                    }
                }
            }
            else if (faction == Faction.Civilian)
            {
                if (spawnerType == SpawnerType.Easy)
                {
                    for (int i = 0; i < maxShips; i++)
                    {
                        Vector2 rndVector = new Vector2(core.random.Next(-500, 500), core.random.Next(-500, 500)) + Position;
                        int[]   comp      = { 1, 1, 0, 0, 0, 0, 0 };
                        //r e s a a a a;
                        ShipNPC   s  = new ShipNPC(rndVector, rndVector, faction, ShipType.CivSmall1, comp, w, AiSearchType.Around, AiAgressiveType.Attack);
                        GunSlot[] gs = { new GunSlot(GunType.GausSmall, s), new GunSlot(GunType.GausSmall, s) };
                        s.AddGuns(gs);
                        s.cargoSize = s.maxCargoSize;
                        s.crewSize  = s.maxCrewSize;
                        s.shipName  = "<BOT> Engi";
                        s.id        = w.GetNpcId();
                        ships.Add(s);
                        w.shipsNpc.Add(s);
                        ServerPacketSender.SendCreateNpcShip(s);
                    }
                }
            }
        }