X-Git-Url: https://plomlompom.com/repos//%22https:/validator.w3.org/check?a=blobdiff_plain;f=new2%2Fplomrogue%2Fgame.py;h=5e33bc49cedc7a408fdb9f5a37415c5bf85346c9;hb=2d26a570e3e4f26a45a476fde6c5b9902607e4b6;hp=e871d59401f1a9418ccc97c5f6c7fd5a055dd58a;hpb=9506b64fe6040ba2489d84ecf852c6e2ad7fef65;p=plomrogue2-experiments diff --git a/new2/plomrogue/game.py b/new2/plomrogue/game.py index e871d59..5e33bc4 100755 --- a/new2/plomrogue/game.py +++ b/new2/plomrogue/game.py @@ -6,7 +6,7 @@ from plomrogue.commands import (cmd_ALL, cmd_LOGIN, cmd_QUERY, cmd_PING, cmd_ANNOTATE, cmd_PORTAL, cmd_GET_GAMESTATE) from plomrogue.io import GameIO from plomrogue.misc import quote -from plomrogue.things import Thing, ThingPlayer +from plomrogue.things import Thing, ThingPlayer from plomrogue.mapping import YX, MapGeometrySquare, Map @@ -14,7 +14,6 @@ from plomrogue.mapping import YX, MapGeometrySquare, Map class GameBase: def __init__(self): - pass self.turn = 0 self.things = [] @@ -86,13 +85,16 @@ class Game(GameBase): def send_thing(thing): self.io.send('THING_POS %s %s' % (thing.id_, t.position)) + if hasattr(thing, 'nickname'): + self.io.send('THING_NAME %s %s' % (thing.id_, quote(t.nickname))) + self.io.send('TURN ' + str(self.turn)) for t in self.things: send_thing(t) self.io.send('MAP %s %s' % (self.map_geometry.size, quote(self.map.terrain))) for yx in self.portals: - self.io.send('PORTAL %s %s' % (yx, self.portals[yx])) + self.io.send('PORTAL %s %s' % (yx, quote(self.portals[yx]))) self.io.send('GAME_STATE_COMPLETE') def run_tick(self): @@ -184,7 +186,7 @@ class Game(GameBase): for yx in self.annotations: write(f, 'ANNOTATE %s %s' % (yx, quote(self.annotations[yx]))) for yx in self.portals: - write(f, 'PORTAL %s %s' % (yx, self.portals[yx])) + write(f, 'PORTAL %s %s' % (yx, quote(self.portals[yx]))) def new_world(self, size): self.map_geometry = MapGeometrySquare(YX(size.y, size.x))