home · contact · privacy
Replace hard-coded client login welcome messages with optional server login messages.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 26 Dec 2020 22:24:29 +0000 (23:24 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 26 Dec 2020 22:24:29 +0000 (23:24 +0100)
plomrogue/commands.py
plomrogue/game.py
rogue_chat.html
rogue_chat.py
rogue_chat_curses.py

index 8376355fdfacdc4d46c5ad546b868c02feb0f6cc..ec31b12ff724774aabe11b9bb0c329f6c2a4b785 100644 (file)
@@ -463,3 +463,7 @@ def cmd_THING_SPAWNPOINT_CREATED(game, spawnpoint_id, timestamp):
         spawnpoint.temporary = True
         spawnpoint.created_at = datetime.datetime.fromtimestamp(timestamp)
 cmd_THING_SPAWNPOINT_CREATED.argtypes = 'int:pos int:nonneg'
+
+def cmd_INTRO_MSG(game, msg):
+    game.intro_messages += [msg]
+cmd_INTRO_MSG.argtypes = 'string'
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))
 
 
 
index e7004a177f913ed3c27e568bdf94b04d3c7f624d..1ace4c3d40c59a68b6be65d9ed34390f6e6f02d1 100644 (file)
@@ -578,8 +578,6 @@ let server = {
             this.send(['GET_GAMESTATE']);
             tui.switch_mode('post_login_wait');
             tui.log_msg('@ welcome!')
-            tui.log_msg('@ hint: see top of terminal for how to get help.')
-            tui.log_msg('@ hint: enter study mode to understand your environment.')
         } else if (tokens[0] === 'DEFAULT_COLORS') {
             terminal.set_default_colors();
         } else if (tokens[0] === 'RANDOM_COLORS') {
index f37477b3c3f28b6c9fdb26ec1d8bbb6d1d3db789..6696a7348088dd5ec6819f79686f5865c7574e75 100755 (executable)
@@ -10,7 +10,7 @@ from plomrogue.commands import (cmd_ALL, cmd_LOGIN, cmd_NICK, cmd_PING, cmd_THIN
                                 cmd_GOD_THING_NAME, cmd_THING_DOOR_CLOSED,
                                 cmd_GOD_THING_PROTECTION, cmd_THING_PROTECTION,
                                 cmd_SET_MAP_CONTROL_PASSWORD, cmd_SPAWN_POINT,
-                                cmd_THING_MUSICPLAYER_SETTINGS,
+                                cmd_THING_MUSICPLAYER_SETTINGS, cmd_INTRO_MSG,
                                 cmd_THING_MUSICPLAYER_PLAYLIST_ITEM, cmd_TERRAIN,
                                 cmd_THING_BOTTLE_EMPTY, cmd_PLAYER_FACE,
                                 cmd_GOD_PLAYER_FACE, cmd_GOD_PLAYER_HAT,
@@ -83,6 +83,7 @@ game.register_command(cmd_GOD_THING_DESIGN)
 game.register_command(cmd_GOD_THING_DESIGN_SIZE)
 game.register_command(cmd_MAP_CONTROL_PRESETS)
 game.register_command(cmd_THING_SPAWNPOINT_CREATED)
+game.register_command(cmd_INTRO_MSG)
 game.register_task(Task_WAIT)
 game.register_task(Task_MOVE)
 game.register_task(Task_WRITE)
index d6d8242e23b4a6c5a41dfc63be02ded75e8081d9..1d327727c3fee4ede955321459c9e1d85b11656b 100755 (executable)
@@ -187,8 +187,6 @@ def cmd_LOGIN_OK(game):
     game.tui.switch_mode('post_login_wait')
     game.tui.send('GET_GAMESTATE')
     game.tui.log_msg('@ welcome!')
-    game.tui.log_msg('@ hint: see top of terminal for how to get help.')
-    game.tui.log_msg('@ hint: enter study mode to understand your environment.')
 cmd_LOGIN_OK.argtypes = ''
 
 def cmd_ADMIN_OK(game):