home · contact · privacy
Replace hard-coded client login welcome messages with optional server login messages.
[plomrogue2] / plomrogue / game.py
index 793c322deb6c4f296348d7c19ac4b562b7ef794f..8784007d8ddeed69e8611a7510e24266c7954dd9 100755 (executable)
@@ -132,6 +132,7 @@ class Game(GameBase):
         self.annotations = {}
         self.spawn_points = []
         self.portals = {}
+        self.intro_messages = []
         self.player_chars = string.digits + string.ascii_letters
         self.players_hat_chars = {}
         self.player_char_i = -1
@@ -355,6 +356,8 @@ class Game(GameBase):
         print('DEBUG LOGIN', t.name, len(self.sessions))
         self.io.send('PLAYER_ID %s' % t.id_, connection_id)
         self.io.send('LOGIN_OK', connection_id)
+        for msg in self.intro_messages:
+            self.io.send('CHAT ' + quote(msg))
         self.io.send('CHAT ' + quote(t.name + ' entered the map.'))
         for s in [s for s in self.things
                   if s.type_ == 'SpawnPoint' and s.name == t.name]:
@@ -601,6 +604,8 @@ class Game(GameBase):
                 next_thing_id += 1
             for s in self.spawn_points:
                 write(f, 'SPAWN_POINT %s %s' % (s[0], s[1]))
+            for msg in self.intro_messages:
+                write(f, 'INTRO_MSG %s' % quote(msg))