home · contact · privacy
Set saner minimal terminal size values in web client.
[plomrogue2] / rogue_chat_curses.py
index c5e4f9dae3929446b9e8be79cd9d8b3476433cf5..18977d2cd4b13e3867f1d52d55fff745143398d1 100755 (executable)
@@ -138,7 +138,8 @@ def cmd_PORTAL(game, position, msg):
 cmd_PORTAL.argtypes = 'yx_tuple:nonneg string'
 
 def cmd_PLAY_ERROR(game, msg):
-    game.tui.flash()
+    game.tui.log_msg('? ' + msg)
+    game.tui.flash = True
     game.tui.do_refresh = True
 cmd_PLAY_ERROR.argtypes = 'string'
 
@@ -290,11 +291,9 @@ class TUI:
         self.force_instant_connect = True
         self.input_lines = []
         self.fov = ''
+        self.flash = False
         curses.wrapper(self.loop)
 
-    def flash(self):
-        curses.flash()
-
     def connect(self):
 
         def handle_recv(msg):
@@ -430,7 +429,7 @@ class TUI:
                 self.explorer = target
                 self.query_info()
             else:
-                self.flash()
+                self.flash = True
 
         def draw_history():
             lines = []
@@ -509,6 +508,8 @@ class TUI:
                 end = start + self.game.map_geometry.size.x
                 map_lines_split += [[c + ' ' for c in map_content[start:end]]]
             if self.map_mode == 'terrain':
+                for p in self.game.portals.keys():
+                    map_lines_split[p.y][p.x] = 'P '
                 used_positions = []
                 for t in self.game.things:
                     symbol = self.game.thing_types[t.type_]
@@ -633,6 +634,9 @@ class TUI:
                 else:
                     self.send('PING')
                 last_ping = now
+            if self.flash:
+                curses.flash()
+                self.flash = False
             if self.do_refresh:
                 draw_screen()
                 self.do_refresh = False
@@ -687,13 +691,6 @@ class TUI:
                             self.send('NICK ' + quote(tokens[1]))
                         else:
                             self.log_msg('? need login name')
-                    #elif self.input_.startswith('/msg'):
-                    #    tokens = self.input_.split(maxsplit=2)
-                    #    if len(tokens) == 3:
-                    #        self.send('QUERY %s %s' % (quote(tokens[1]),
-                    #                                          quote(tokens[2])))
-                    #    else:
-                    #        self.log_msg('? need message target and message')
                     else:
                         self.log_msg('? unknown command')
                 else:
@@ -752,7 +749,7 @@ class TUI:
                         self.host = self.game.portals[player.position]
                         self.reconnect()
                     else:
-                        self.flash()
+                        self.flash = True
                         self.log_msg('? not standing on portal')
                 elif key in self.movement_keys and 'MOVE' in self.game.tasks:
                     self.send('TASK:MOVE ' + self.movement_keys[key])
@@ -760,4 +757,5 @@ class TUI:
                 self.send('TASK:WRITE %s %s' % (key, quote(self.password)))
                 self.switch_mode('play')
 
-TUI('localhost:5000')
+#TUI('localhost:5000')
+TUI('wss://plomlompom.com/rogue_chat/')