Beispiel #1
0
        //original 1.32 code -- Incin
        private Unit ServerOrSingle_CreatePlayerUnit(PlayerManager.ServerOrSingle_Player player)
        {
            SpawnPoint spawnPoint = null;

            if (GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
            {
                List <SpawnPoint> instancePoints = SpawnPoint.Instances();
                foreach (SpawnPoint sp in instancePoints)
                {
                    if (sp == null || sp.Faction == null) //Incin -- additional check
                    {
                        return(null);
                    }

                    if (sp.Faction != player.Intellect.Faction)
                    {
                        continue;
                    }
                    if (sp.SpawnID != (SpawnPoint.SpawnId)player.User.SpawnId)
                    {
                        continue;
                    }
                    //spawnPoint = SpawnPoint.GetDefaultSpawnPoint();
                    spawnPoint = sp;

                    if (spawnPoint != null)
                    {
                        return(ServerOrSingle_CreatePlayerUnit(player, spawnPoint));
                    }

                    ////Other Game Modes
                    //if (spawnPoint == null)
                    //    spawnPoint = SpawnPoint.GetDefaultSpawnPoint();

                    //if (spawnPoint == null)
                    //    spawnPoint = SpawnPoint.GetFreeRandomSpawnPoint();

                    if (spawnPoint == null)
                    {
                        return(null);
                    }

                    return(ServerOrSingle_CreatePlayerUnit(player, spawnPoint));
                }
            }
            else
            {
                //Other Game Modes
                if (spawnPoint == null)
                {
                    spawnPoint = SpawnPoint.GetDefaultSpawnPoint();
                }

                if (spawnPoint == null)
                {
                    spawnPoint = SpawnPoint.GetFreeRandomSpawnPoint();
                }

                if (spawnPoint == null)
                {
                    return(null);
                }

                return(ServerOrSingle_CreatePlayerUnit(player, spawnPoint));
            }

            return(null);
        }
        public static SpawnId AKGetSpawnIdBySpawnIdwithFacton(SpawnPoint spawnpoint, FactionType faction)
        {
            foreach (SpawnPoint sp in instances)
            {
                if (sp.faction != faction)
                    continue;

                if (sp.SpawnID != spawnpoint.SpawnID)
                {
                    continue;
                }

                return spawnpoint.SpawnID;
            }
            return SpawnId.NONE;
        }
 //Incin -- SpawnId Network Messages
 public bool IsSpawnId(SpawnPoint spawnpoint, SpawnId id)
 {
     if (spawnpoint.SpawnID == id)
         return true;
     else
         return false;
 }
 public SpawnId GetSpawnId(SpawnPoint spawnpoint)
 {
     return spawnpoint.spawnid;
 }
 //iNCIN return spawn Id
 public bool IsSpawnId(SpawnPoint spawnpoint)
 {
     if (spawnpoint.SpawnID == this.SpawnID)
         return true;
     else
         return false;
 }
 public SpawnId GetSpawnId(SpawnPoint spawnpoint)
 {
     return(spawnpoint.spawnid);
 }