Esempio n. 1
0
        /// <summary>
        /// Determines whether there is a bot antiwarping the player in the specified area
        /// </summary>
        public Bot checkBotAntiwarp(Player player)
        {       //Get the list of bots in the area
            IEnumerable <Bot> candidates = _bots.getObjsInRange(player._state.positionX, player._state.positionY, 1000);

            foreach (Bot candidate in candidates)
            {   //Any anti-warp utils?
                if (!candidate._activeEquip.Any(util => util.antiWarpDistance != -1))
                {
                    continue;
                }

                //Ignore your own team
                if (candidate._team == player._team)
                {
                    continue;
                }

                //Is it within the distance?
                int dist = (int)(player._state.position().Distance(candidate._state.position()) * 100);

                if (candidate._activeEquip.Any(util => util.antiWarpDistance >= dist))
                {
                    return(candidate);
                }
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Determines whether there is a vehicle antiwarping the player in the specified area
        /// </summary>
        public Computer checkVehAntiWarp(Player player)
        {
            ObjTracker <Computer> computers = new ObjTracker <Computer>();

            foreach (Vehicle vehicle in _vehicles)
            {   //Cast it properly
                Computer computer = vehicle as Computer;
                if (computer == null)
                {
                    continue;
                }
                else
                {
                    computers.Add(computer);
                }
            }

            //Get the list of computers in the area
            List <Computer> candidates = candidates = computers.getObjsInRange(player._state.positionX, player._state.positionY, 5000);

            foreach (Computer candidate in candidates)
            {   //Any anti-warp utils?
                if (!candidate._activeEquip.Any(util => util.antiWarpDistance != -1))
                {
                    continue;
                }

                //Ignore your own team
                if (candidate._team == player._team)
                {
                    continue;
                }

                //Is computer still operable?
                if (candidate._state.health < candidate._type.HitpointsRequiredToOperate)
                {
                    continue;
                }

                //Is it within the distance?
                int dist = (int)(player._state.position().Distance(candidate._state.position()) * 100);
                if (candidate._activeEquip.Any(util => util.antiWarpDistance >= dist))
                {
                    return(candidate);
                }
            }

            return(null);
        }
Esempio n. 3
0
 /// <summary>
 /// Gets all vehicles within the specified range
 /// </summary>
 public List <Vehicle> getVehiclesInRange(int posX, int posY, int range)
 {
     return(_vehicles.getObjsInRange(posX, posY, range));
 }