home · contact · privacy
Improve player error messages, and log them to clients.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 15 Nov 2020 23:19:48 +0000 (00:19 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 15 Nov 2020 23:19:48 +0000 (00:19 +0100)
plomrogue/tasks.py
rogue_chat_curses.py
rogue_chat_nocanvas_monochrome.html

index 6d1a32a75e65b4a5a7fe74a40634f260e85e4d1c..ff1cc7ea613d721eec2ffa7c7368b48fa62117fc 100644 (file)
@@ -40,7 +40,7 @@ class Task_MOVE(Task):
                           if t.blocking]:
             raise PlayError('blocked by other thing')
         elif self.thing.game.map[test_pos] != '.':
-            raise PlayError('would move into illegal territory')
+            raise PlayError('blocked by impassable tile')
 
     def do(self):
         self.thing.position = self.get_move_target()
@@ -85,7 +85,7 @@ class Task_PICK_UP(Task):
 
     def check(self):
         if self.thing.carrying:
-            raise PlayError('already carrying')
+            raise PlayError('already carrying something')
         nothing_to_pick_up = True
         for t in [t for t in self.thing.game.things
                   if t != self.thing and t.position == self.thing.position
index 99400941f09e3ef9b30b4660b3e4e9b24f4953a5..2dfbdd1b6b76772877ac47b9db7c04b4e199e919 100755 (executable)
@@ -138,6 +138,7 @@ def cmd_PORTAL(game, position, msg):
 cmd_PORTAL.argtypes = 'yx_tuple:nonneg string'
 
 def cmd_PLAY_ERROR(game, msg):
+    game.tui.log_msg('? ' + msg)
     game.tui.flash()
     game.tui.do_refresh = True
 cmd_PLAY_ERROR.argtypes = 'string'
index 0890647eb7d288081664946aea3e6394f02a7d49..3d45954989044a3ce65f677bfd1beb6ff228b888 100644 (file)
@@ -279,6 +279,7 @@ let server = {
         } else if (tokens[0] === 'UNHANDLED_INPUT') {
             tui.log_msg('? unknown command');
         } else if (tokens[0] === 'PLAY_ERROR') {
+            tui.log_msg('? ' + tokens[1]);
             terminal.blink_screen();
         } else if (tokens[0] === 'ARGUMENT_ERROR') {
             tui.log_msg('? syntax error: ' + tokens[1]);