home · contact · privacy
Spawn hats from BottleDeposit, add HatRemixer.
[plomrogue2] / plomrogue / game.py
index 017580f24e4cb28ef98062f4d11026b2a02894ca..5e206b9c8c289155a59aa7700dd9306ea4e05e79 100755 (executable)
@@ -122,6 +122,7 @@ class Game(GameBase):
         self.thing_types = {}
         self.sessions = {}
         self.faces = {}
+        self.hats = {}
         self.maps = {}
         self.map_controls = {}
         self.map_control_passwords = {}
@@ -246,6 +247,9 @@ class Game(GameBase):
                              c_id)
                 if hasattr(t, 'name'):
                     self.io.send('THING_NAME %s %s' % (t.id_, quote(t.name)), c_id)
+                    if t.type_ == 'Player' and t.name in self.hats:
+                        hat = self.hats[t.name]
+                        self.io.send('THING_HAT %s %s' % (t.id_, quote(hat)), c_id)
                 face = self.get_face(t)
                 if face:
                     self.io.send('THING_FACE %s %s' % (t.id_, quote(face)), c_id)
@@ -386,6 +390,9 @@ class Game(GameBase):
             for name in self.faces:
                 write(f, 'GOD_PLAYER_FACE %s %s' % (quote(name),
                                                     quote(self.faces[name])))
+            for name in self.hats:
+                write(f, 'GOD_PLAYER_HAT %s %s' % (quote(name),
+                                                   quote(self.hats[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_))
@@ -396,6 +403,9 @@ class Game(GameBase):
                     write(f, 'THING_INSTALLED %s' % t.id_)
                 if t.type_ == 'Door' and t.blocking:
                     write(f, 'THING_DOOR_CLOSED %s' % t.id_)
+                elif t.type_ == 'Hat':
+                    write(f, 'THING_HAT_DESIGN %s %s' % (t.id_,
+                                                         quote(t.design)))
                 elif t.type_ == 'MusicPlayer':
                     write(f, 'THING_MUSICPLAYER_SETTINGS %s %s %s %s' %
                           (t.id_, int(t.playing), t.playlist_index, int(t.repeat)))