Пример #1
0
 def new_player(self,insim, npl):
     '''
     ISP_NPL
     Add the new player to the players dict.
     '''
     #players[npl.PLID] = npl
     try:
         print 'New player: %s' % pyinsim.stripcols(npl.PName)
         
         if(self.traker_enabled==False):
             return
         
         if(npl.UCID==0):
             print('Warning Tracker doesnt work well in offline mode. Do not use AIs in offline mode')
             #self.tracker=False
             #self.exit_app()
         
         print 'Driver name '+ npl.PName + " UCID: "+str(npl.UCID)+ " PLID: "+str(npl.PLID) 
         if(self.drivers[npl.UCID] is  None):
             
             self.drivers[npl.UCID]=Driver(npl)
             
         self.driversID[npl.PLID]=npl.UCID
         
         self.drivers[npl.UCID].player_id=npl.PLID
         self.drivers[npl.UCID].status=2
         self.drivers[npl.UCID].car_name=npl.CName
         self.drivers[npl.UCID].tyre_compounds=npl.Tyres
         self.drivers[npl.UCID].set_playername(npl.PName) 
         #self.print_all_drivers()
     except:
         print "Key error"
Пример #2
0
    def new_player(self, insim, npl):
        '''
        ISP_NPL
        Add the new player to the players dict.
        '''
        #players[npl.PLID] = npl
        try:
            print 'New player: %s' % pyinsim.stripcols(npl.PName)

            if (self.traker_enabled == False):
                return

            if (npl.UCID == 0):
                print(
                    'Warning Tracker doesnt work well in offline mode. Do not use AIs in offline mode'
                )
                #self.tracker=False
                #self.exit_app()

            print 'Driver name ' + npl.PName + " UCID: " + str(
                npl.UCID) + " PLID: " + str(npl.PLID)
            if (self.drivers[npl.UCID] is None):

                self.drivers[npl.UCID] = Driver(npl)

            self.driversID[npl.PLID] = npl.UCID

            self.drivers[npl.UCID].player_id = npl.PLID
            self.drivers[npl.UCID].status = 2
            self.drivers[npl.UCID].car_name = npl.CName
            self.drivers[npl.UCID].tyre_compounds = npl.Tyres
            self.drivers[npl.UCID].set_playername(npl.PName)
            #self.print_all_drivers()
        except:
            print "Key error"
Пример #3
0
 def select_host(self, relay):
     try:
         # Choose a random host.
         host = random.choice(relay.hosts)
     except IndexError:
         relay.close()
         print 'There are no hosts!' # Unlikely :p
     else:
         print 'Selected host: %s (%s)' % (pyinsim.stripcols(host.HName), relay.name)
         relay.send(pyinsim.IRP_SEL, HName=host.HName) # Select host.
         relay.send(pyinsim.ISP_TINY, ReqI=255, SubT=pyinsim.TINY_NCN) # Request conns list.
Пример #4
0
def player_left(insim, pll):
    # Get player from the players dict.
    npl = players[pll.PLID]
    # Delete them from the dict.
    del players[pll.PLID]
    print 'Player left: %s' % pyinsim.stripcols(npl.PName)
Пример #5
0
def new_player(insim, npl):
    # Add the new player to the players dict.
    players[npl.PLID] = npl
    print 'New player: %s' % pyinsim.stripcols(npl.PName)
Пример #6
0
def player_left(insim, pll):
    # Get player from the players dict.
    npl = players[pll.PLID]
    # Delete them from the dict.
    del players[pll.PLID]
    print 'Player left: %s' % pyinsim.stripcols(npl.PName)
Пример #7
0
def new_player(insim, npl):
    # Add the new player to the players dict.
    players[npl.PLID] = npl
    print 'New player: %s' % pyinsim.stripcols(npl.PName)