From: Christian Heller Date: Sun, 25 Oct 2020 04:11:32 +0000 (+0100) Subject: Prohibit movement over non-dot map cells X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/te"st.html?a=commitdiff_plain;h=0d6e4ded54a3cff9ec068dc329796b781b9d7e16;p=plomrogue2-experiments Prohibit movement over non-dot map cells --- diff --git a/new2/plomrogue/tasks.py b/new2/plomrogue/tasks.py index fffb36a..e600122 100644 --- a/new2/plomrogue/tasks.py +++ b/new2/plomrogue/tasks.py @@ -36,6 +36,8 @@ class Task_MOVE(Task): test_pos = self.get_move_target() if test_pos is None: raise GameError('would move out of map') + elif self.thing.game.map[test_pos] != '.': + raise GameError('would move into illegal territory') def do(self): self.thing.position = self.get_move_target() diff --git a/new2/rogue_chat.html b/new2/rogue_chat.html index a3d5095..6b37d6c 100644 --- a/new2/rogue_chat.html +++ b/new2/rogue_chat.html @@ -169,11 +169,12 @@ tui.log_msg("LOGIN USER - register as USER", 3); tui.log_msg("ALL TEXT - send TEXT to all users", 3); tui.log_msg("QUERY USER TEXT - send TEXT to USER", 3); tui.log_msg(""); -tui.log_msg("Use arrow keys to move your avatar", 1); +tui.log_msg("Use arrow keys to move your avatar. You can only move over \".\" map cells.", 1); tui.log_msg(""); tui.log_msg("Use double quotes for strings that contain whitespace, escape them with \\.", 1); tui.log_msg(""); -tui.log_msg("To write on the map, hit Return on a single visible ASCII character in the input prompt", 1); +tui.log_msg("To change the map cell you are standing on, type the desired ASCII character into the prompt and hit Return.", 1); +tui.log_msg(""); document.addEventListener('keydown', (event) => { if (chat.input_line === '') {