home · contact · privacy
Enable Hat editing with characters earned by eating cookies from a CookieSpawner.
[plomrogue2] / plomrogue / game.py
index 78598143628df6057efc41e4e216af0f211de4d6..a3a636def40ba816c7dd658465f47bb2a59d4a54 100755 (executable)
@@ -132,6 +132,7 @@ class Game(GameBase):
         self.spawn_point = YX(0, 0), YX(0, 0)
         self.portals = {}
         self.player_chars = string.digits + string.ascii_letters
+        self.players_hat_chars = {}
         self.player_char_i = -1
         self.admin_passwords = []
         self.send_gamestate_interval = datetime.timedelta(seconds=0.04)
@@ -277,6 +278,8 @@ class Game(GameBase):
                 # collected here as a shortcut, but a cleaner way would be to
                 # differentiate the changes somehow.
                 self.io.send('PSEUDO_FOV_WIPE', c_id)
+                self.io.send('PLAYERS_HAT_CHARS ' + quote(player.get_cookie_chars()),
+                             c_id)
                 for t in player.seen_things:
                     target_yx = player.fov_stencil.target_yx(*t.position)
                     self.io.send('THING %s %s %s %s %s %s'
@@ -446,7 +449,7 @@ class Game(GameBase):
         return self.get_foo_blockers('movement')
 
     def get_flatland(self):
-        for t in self.terrains.values:
+        for t in self.terrains.values():
             if not t.blocks_movement:
                 return t.character
 
@@ -491,6 +494,9 @@ class Game(GameBase):
             for name in self.hats:
                 write(f, 'GOD_PLAYER_HAT %s %s' % (quote(name),
                                                    quote(self.hats[name])))
+            for name in self.players_hat_chars:
+                write(f, 'GOD_PLAYERS_HAT_CHARS %s %s' %
+                      (quote(name), quote(self.players_hat_chars[name])))
             for t in [t for t in self.things if not t.type_ == 'Player']:
                 write(f, 'THING %s %s %s %s' % (t.position[0],
                                                 t.position[1], t.type_, t.id_))