self.send_all('MAP_SIZE ' + self.stringify_yx(self.world.map_size))
for y in range(self.world.map_size[0]):
width = self.world.map_size[1]
- terrain_line = self.world.map_[y * width:(y + 1) * width]
+ terrain_line = self.world.terrain_map[y * width:(y + 1) * width]
self.send_all('TERRAIN_LINE %5s %s' % (y, self.quoted(terrain_line)))
for thing in self.world.things:
self.send_all('THING_TYPE %s %s' % (thing.id_, thing.type_))
self.world.proceed_to_next_player_turn()
self.send_all_gamestate()
- def get_player(self):
- return self.world.get_thing(self.world.player_id)
-
def cmd_MOVE(self, direction, connection_id):
"""Set player task to 'move' with direction arg, finish player turn."""
if direction not in {'UP', 'DOWN', 'RIGHT', 'LEFT'}:
raise ArgError('Move argument must be one of: '
'UP, DOWN, RIGHT, LEFT')
- self.get_player().set_task('move', direction=direction)
+ self.world.get_player().set_task('move', direction=direction)
self.proceed()
cmd_MOVE.argtypes = 'string'
def cmd_WAIT(self, connection_id):
"""Set player task to 'wait', finish player turn."""
- self.get_player().set_task('wait')
+ self.world.get_player().set_task('wait')
self.proceed()
def cmd_MAP_SIZE(self, yx, connection_id):