X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;ds=sidebyside;f=rogue_chat_nocanvas_monochrome.html;h=7a479d0b0cd85730a941f88d9668b2826210eb61;hb=6a70ba4e9d6e3ff89b2cdd40ef65e600e6ed6548;hp=f037bc74978d5f837434a40c9b65aa038a7c1ed3;hpb=c44edaea10aa907301a47f19e492f1d869d528d9;p=plomrogue2 diff --git a/rogue_chat_nocanvas_monochrome.html b/rogue_chat_nocanvas_monochrome.html index f037bc7..7a479d0 100644 --- a/rogue_chat_nocanvas_monochrome.html +++ b/rogue_chat_nocanvas_monochrome.html @@ -24,6 +24,7 @@ terminal columns: +
@@ -44,6 +45,7 @@ terminal columns:
  • move left (hex grid):
  • help:
  • flatten surroundings: +
  • teleport:
  • take thing under player:
  • drop carried thing:
  • switch to chat mode: @@ -266,12 +268,6 @@ let server = { } else if (tui.mode == mode_study) { explorer.query_info(); } - let t = game.get_thing(game.player_id); - if (t.position in game.portals) { - tui.teleport_target = game.portals[t.position]; - tui.switch_mode(mode_teleport); - return; - } tui.full_refresh(); } else if (tokens[0] === 'CHAT') { tui.log_msg('# ' + tokens[1], 1); @@ -344,7 +340,6 @@ let mode_chat = new Mode('chat', 'This mode allows you to engage in chit-chat wi let mode_play = new Mode('play', 'This mode allows you to interact with the map.', false, false); let mode_study = new Mode('study', 'This mode allows you to study the map and its tiles in detail. Move the question mark over a tile, and the right half of the screen will show detailed information on it.', false, true); let mode_edit = new Mode('edit', 'This mode allows you to change the map tile you currently stand on (if your map editing password authorizes you so). Just enter any printable ASCII character to imprint it on the ground below you.', false, false); -let mode_teleport = new Mode('teleport', 'Follow the instructions to re-connect and log-in to another server, or enter anything else to abort.', true); let mode_portal = new Mode('portal', 'This mode allows you to imprint/edit/remove a teleportation target on the ground you are currently standing on (provided your map editing password authorizes you so). Enter or edit a URL to imprint a teleportation target; enter emptiness to remove a pre-existing teleportation target. Hit Return to leave.', true, true); let mode_password = new Mode('password', 'This mode allows you to change the password that you send to authorize yourself for editing password-protected map tiles. Hit return to confirm and leave.', true, false, false); @@ -401,6 +396,7 @@ let tui = { document.getElementById("take_thing").disabled = true; document.getElementById("drop_thing").disabled = true; document.getElementById("flatten").disabled = true; + document.getElementById("teleport").disabled = true; document.getElementById("toggle_map_mode").disabled = true; document.getElementById("switch_to_chat").disabled = true; document.getElementById("switch_to_play").disabled = true; @@ -457,6 +453,7 @@ let tui = { } if (game.tasks.includes('MOVE')) { } + document.getElementById("teleport").disabled = false; document.getElementById("switch_to_annotate").disabled = false; document.getElementById("switch_to_edit").disabled = false; document.getElementById("switch_to_portal").disabled = false; @@ -465,9 +462,6 @@ let tui = { document.getElementById("toggle_map_mode").disabled = false; } else if (mode == mode_edit) { this.show_help = true; - } else if (mode == mode_teleport) { - tui.log_msg("@ May teleport to: " + tui.teleport_target); - tui.log_msg("@ Enter 'YES!' to entusiastically affirm."); } this.full_refresh(); }, @@ -539,6 +533,10 @@ let tui = { }; map_lines_split.push(line); if (this.map_mode == 'terrain') { + for (const p in game.portals) { + let coordinate = p.split(',') + map_lines_split[coordinate[0]][coordinate[1]] = 'P '; + } let used_positions = []; for (const thing_id in game.things) { let t = game.things[thing_id]; @@ -646,6 +644,7 @@ let tui = { if (game.tasks.includes('FLATTEN_SURROUNDINGS')) { content += "[" + tui.keys.flatten + "] – flatten player's surroundings\n"; } + content += "[" + tui.keys.teleport + "] – teleport to other space\n"; content += '\nOther modes available from here:\n'; content += '[' + this.keys.switch_to_chat + '] – chat mode\n'; content += '[' + this.keys.switch_to_study + '] – study mode\n'; @@ -762,6 +761,15 @@ let game = { return null; }; return target; + }, + teleport: function() { + let player = this.get_thing(game.player_id); + if (player.position in this.portals) { + server.reconnect_to(this.portals[player.position]); + } else { + terminal.blink_screen(); + tui.log_msg('? not standing on portal') + } } } @@ -888,13 +896,6 @@ tui.inputEl.addEventListener('keydown', (event) => { } tui.password = tui.inputEl.value tui.switch_mode(mode_play); - } else if (tui.mode == mode_teleport && event.key == 'Enter') { - if (tui.inputEl.value == 'YES!') { - server.reconnect_to(tui.teleport_target); - } else { - tui.log_msg('@ teleport aborted'); - tui.switch_mode(mode_play); - }; } else if (tui.mode == mode_chat && event.key == 'Enter') { let [tokens, token_starts] = parser.tokenize(tui.inputEl.value); if (tokens.length > 0 && tokens[0].length > 0) { @@ -951,6 +952,8 @@ tui.inputEl.addEventListener('keydown', (event) => { } else if (event.key in tui.movement_keys && game.tasks.includes('MOVE')) { server.send(['TASK:MOVE', tui.movement_keys[event.key]]); + } else if (event.key === tui.keys.teleport) { + game.teleport(); } else if (event.key === tui.keys.switch_to_portal) { event.preventDefault(); tui.switch_mode(mode_portal); @@ -1064,6 +1067,9 @@ document.getElementById("drop_thing").onclick = function() { document.getElementById("flatten").onclick = function() { server.send(['TASK:FLATTEN_SURROUNDINGS', tui.password]); }; +document.getElementById("teleport").onclick = function() { + game.teleport(); +}; document.getElementById("move_upleft").onclick = function() { if (tui.mode == mode_play) { server.send(['TASK:MOVE', 'UPLEFT']);