def send_gamestate(self, connection_id=None):
"""Send out game state data relevant to clients."""
def send_gamestate(self, connection_id=None):
"""Send out game state data relevant to clients."""
- def send_thing(offset, thing):
- offset_pos = self.map_geometry.pos_in_projection(thing.position,
- offset,
- self.map_size)
+ def send_thing(thing):
+ view_pos = self.map_geometry.pos_in_view(thing.position,
+ self.player.view_offset,
+ self.map_size)
for y, line in visible_map.lines():
self.io.send('VISIBLE_MAP_LINE %5s %s' % (y, quote(line)))
visible_things = self.player.get_visible_things()
for thing in visible_things:
for y, line in visible_map.lines():
self.io.send('VISIBLE_MAP_LINE %5s %s' % (y, quote(line)))
visible_things = self.player.get_visible_things()
for thing in visible_things:
if hasattr(thing, 'health'):
self.io.send('THING_HEALTH %s %s' % (thing.id_,
thing.health))
if hasattr(thing, 'health'):
self.io.send('THING_HEALTH %s %s' % (thing.id_,
thing.health))
self.io.send('PLAYER_INVENTORY ,')
for id_ in self.player.inventory:
thing = self.get_thing(id_)
self.io.send('PLAYER_INVENTORY ,')
for id_ in self.player.inventory:
thing = self.get_thing(id_)