Ejemplo n.º 1
0
 def remove_player(self, name):
     if name not in self.players:
         raise error.NoSuchPlayer(name)
     player = self.players.pop(name)
     self.free_cars.add(player.car)
     self.free_lanes.add(player.lane)
     print 'remove player:', name, 'lane:', player.lane, 'car:', player.car
     reactor.callLater(0, self.update_players)
Ejemplo n.º 2
0
 def remove_player(self, name):
     if name not in self.players:
         raise error.NoSuchPlayer(name)
     player = self.players.pop(name)
     self.free_cars.add(player.car)
     self.free_lanes.add(player.lane)
     log.info('remove player: %r, lane: %r, car: %r', name, player.lane,
              player.car)
     reactor.callLater(0, self.update_clients)
Ejemplo n.º 3
0
 def drive_player(self, name, info):
     log.info('drive_player: %r %r', name, info)
     if name not in self.players:
         raise error.NoSuchPlayer(name)
     if 'action' not in info:
         raise error.InvalidMessage("action required")
     action = info['action']
     if action not in actions.ALL:
         raise error.InvalidMessage("invalid drive action %s" % action)
     self.players[name].action = action
     self.players[name].response_time = info.get('response_time', 1.0)
Ejemplo n.º 4
0
 def remove_player(self, name):
     if name not in self.players:
         raise error.NoSuchPlayer(name)
     player = self.players.pop(name)
     self.free_cars.add(player.car)
     self.free_lanes.add(player.lane)
     log.info('remove player: %r, lane: %r, car: %r', name, player.lane,
              player.car)
     if not self.players and self.started:
         log.info('Stopping game. No players connected.')
         self.stop()
     else:
         reactor.callLater(0, self.update_clients)