+ elif key == '\t': # Tabulator key.
+ map_mode = False if map_mode else True
+ elif map_mode:
+ if type(self.game.world.map_) == MapSquare:
+ if key == 'a':
+ plom_socket_io.send(self.socket, 'MOVE LEFT')
+ elif key == 'd':
+ plom_socket_io.send(self.socket, 'MOVE RIGHT')
+ elif key == 'w':
+ plom_socket_io.send(self.socket, 'MOVE UP')
+ elif key == 's':
+ plom_socket_io.send(self.socket, 'MOVE DOWN')
+ elif type(self.game.world.map_) == MapHex:
+ if key == 'w':
+ plom_socket_io.send(self.socket, 'MOVE UPLEFT')
+ elif key == 'e':
+ plom_socket_io.send(self.socket, 'MOVE UPRIGHT')
+ if key == 's':
+ plom_socket_io.send(self.socket, 'MOVE LEFT')
+ elif key == 'd':
+ plom_socket_io.send(self.socket, 'MOVE RIGHT')
+ if key == 'x':
+ plom_socket_io.send(self.socket, 'MOVE DOWNLEFT')
+ elif key == 'c':
+ plom_socket_io.send(self.socket, 'MOVE DOWNRIGHT')
+ else:
+ if len(key) == 1 and key in ASCII_printable and \
+ len(self.to_send) < len(self.edit):
+ self.to_send += [key]
+ self.to_update['edit'] = True
+ elif key == 'KEY_BACKSPACE':
+ self.to_send[:] = self.to_send[:-1]
+ self.to_update['edit'] = True
+ elif key == '\n': # Return key
+ plom_socket_io.send(self.socket, ''.join(self.to_send))
+ self.to_send[:] = []
+ self.to_update['edit'] = True