def car_contact (self, insim, info): InsimClient.car_contact(self, insim, info) print info mcar=info.A #track='KY1R' if(info.SpClose>1): driv_a='' driv_b='' try: driv_a=self.drivers[self.driversID[info.A.PLID]].playername driv_b=self.drivers[self.driversID[info.B.PLID]].playername except: print 'Cant locate driver name, maybe this key is deleted PLID A:',str(info.A.PLID),' B ',info.B.PLID return m= 'Contacto ^7A '+ driv_a+ ' y B'+ driv_b print m print info.Time self.sendMsg(m) p=[mcar.X/16, mcar.Y/16 ] #KY1R Nodes t_coords=[[-461,181],[-484,295],[-485 , 681],[-104 , 845],[187 , 594],[ 250 , 260],[54 , -81],[-354 , -57]] t_names=['T1','T1-T2','T2','T2-T3','T3','T3-T4','T4','T4-T1'] #KY1 Nodes if(self.track=='KY1'): t_coords.reverse() tmp=0 m=9000000 t_f=0 for pl in t_coords: p1=pl if(t_coords.index(pl)==len(t_coords)-1): #last element p2=t_coords[0] else: p2=t_coords[t_coords.index(pl)+1] d=self.pointline_dist(p1, p2, p) print 'Distance To Line ',tmp, ' D: ',d if(d<m): m=d t_f=t_names[tmp] tmp+=1 #print 'Precaucion en ',t_f #self.sendMsg('^2Precaucion en '+str(t_f)) if(self.config.get("crash_list","reg_crash")=="yes"): self.crash_msg_queue.appendleft(str(t_f)) self.last_time_crash=time.time() self.add_crash(Crash_event(self.get_driver(info.A.PLID).get_playername(), self.get_driver(info.B.PLID).get_playername(),info.A.PLID,info.B.PLID, float(info.SpClose), p[0],p[1], t_f,info.Time)) #schedule the message destroy WorkDaemon(self.pop_crash_queue,10,True).start()#destroy it in ten seconds
def car_contact (self, insim, info): InsimClient.car_contact(self, insim, info) b=False if("yes" in self.sa): b=True elif(self.current_driver_id==info.A.PLID or self.current_driver_id==info.B.PLID): b=True if(b): self.print_log('^3Car contact:^7 CSp='+ str(float(info.SpClose)/10)+' A= '+self.get_driver(info.A.PLID).get_playername()+' B '+self.get_driver(info.B.PLID).get_playername(),True) #self.sendMsg('^3CON PACKET:^7 CSp='+ str(info.SpClose/10),'')
def car_contact(self, insim, info): InsimClient.car_contact(self, insim, info) b = False if ("yes" in self.sa): b = True elif (self.current_driver_id == info.A.PLID or self.current_driver_id == info.B.PLID): b = True if (b): self.print_log( '^3Car contact:^7 CSp=' + str(float(info.SpClose) / 10) + ' A= ' + self.get_driver(info.A.PLID).get_playername() + ' B ' + self.get_driver(info.B.PLID).get_playername(), True)