From: Christian Heller Date: Sun, 15 Nov 2020 23:19:48 +0000 (+0100) Subject: Improve player error messages, and log them to clients. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/conditions?a=commitdiff_plain;h=ee3263e4b0bbc9146040c58bb3ed9bb1653102c1;p=plomrogue2 Improve player error messages, and log them to clients. --- diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index 6d1a32a..ff1cc7e 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -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 diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 9940094..2dfbdd1 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -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' diff --git a/rogue_chat_nocanvas_monochrome.html b/rogue_chat_nocanvas_monochrome.html index 0890647..3d45954 100644 --- a/rogue_chat_nocanvas_monochrome.html +++ b/rogue_chat_nocanvas_monochrome.html @@ -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]);