X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=rogue_chat_nocanvas_monochrome.html;h=4adb4ee24c7875b6775b7b904b3b23b6665712c1;hb=8c5624db0c2b463a490a425fc0f8baf2761d7d23;hp=307bf2619ba02c8f580fb10bf1dd21232d601012;hpb=ea611b9ddebf789794ba938d2a25477dfc8862e3;p=plomrogue2 diff --git a/rogue_chat_nocanvas_monochrome.html b/rogue_chat_nocanvas_monochrome.html index 307bf26..4adb4ee 100644 --- a/rogue_chat_nocanvas_monochrome.html +++ b/rogue_chat_nocanvas_monochrome.html @@ -173,6 +173,7 @@ let server = { this.websocket = new WebSocket(this.url); this.websocket.onopen = function(event) { window.setInterval(function() { server.send(['PING']) }, 30000); + this.send('TASKS'); tui.log_msg("@ server connected! :)"); tui.switch_mode(mode_login); }; @@ -203,6 +204,8 @@ let server = { game.get_thing(tokens[1], true).position = parser.parse_yx(tokens[2]); } else if (tokens[0] === 'THING_NAME') { game.get_thing(tokens[1], true).name_ = tokens[2]; + } else if (tokens[0] === 'TASKS') { + game.tasks = tokens[1].split(',') } else if (tokens[0] === 'MAP') { game.map_geometry = tokens[1]; tui.init_keys(); @@ -411,13 +414,22 @@ let tui = { this.log_msg(" /" + this.keys.switch_to_play + " or /play - switch to play mode"); this.log_msg(" /" + this.keys.switch_to_study + " or /study - switch to study mode"); this.log_msg("commands common to study and play mode:"); - this.log_msg(" " + movement_keys_desc + " - move"); + if (game.tasks.includes('MOVE')) { + this.log_msg(" " + movement_keys_desc + " - move"); + } this.log_msg(" " + this.keys.switch_to_chat + " - switch to chat mode"); this.log_msg("commands specific to play mode:"); - this.log_msg(" " + this.keys.switch_to_edit + " - write following ASCII character"); - this.log_msg(" " + this.keys.flatten + " - flatten surroundings"); + if (game.tasks.includes('WRITE')) { + this.log_msg(" " + this.keys.switch_to_edit + " - write following ASCII character"); + } + if (game.tasks.includes('FLATTEN_SURROUNDINGS')) { + this.log_msg(" " + this.keys.flatten + " - flatten surroundings"); + } this.log_msg(" " + this.keys.switch_to_study + " - switch to study mode"); this.log_msg("commands specific to study mode:"); + if (!game.tasks.includes('MOVE')) { + this.log_msg(" " + movement_keys_desc + " - move"); + } this.log_msg(" " + this.keys.switch_to_annotate + " - annotate terrain"); this.log_msg(" " + this.keys.switch_to_play + " - switch to play mode"); }, @@ -538,6 +550,7 @@ let game = { this.map_size = [0,0]; this.player_id = -1; this.portals = {}; + this.tasks = {}; }, get_thing: function(id_, create_if_not_found=false) { if (id_ in game.things) { @@ -716,9 +729,9 @@ tui.inputEl.addEventListener('keydown', (event) => { tui.log_help(); } else if (tokens[0].slice(1) == 'nick') { if (tokens.length > 1) { - server.send(['LOGIN', tokens[1]]); + server.send(['NICK', tokens[1]]); } else { - tui.log_msg('? need login name'); + tui.log_msg('? need new name'); } } else if (tokens[0].slice(1) == 'msg') { if (tokens.length > 2) { @@ -748,14 +761,17 @@ tui.inputEl.addEventListener('keydown', (event) => { if (event.key === tui.keys.switch_to_chat) { event.preventDefault(); tui.switch_mode(mode_chat); - } else if (event.key === tui.keys.switch_to_edit) { + } else if (event.key === tui.keys.switch_to_edit + && game.tasks.includes('WRITE')) { event.preventDefault(); tui.switch_mode(mode_edit); } else if (event.key === tui.keys.switch_to_study) { tui.switch_mode(mode_study); - } else if (event.key === tui.keys.flatten) { + } else if (event.key === tui.keys.flatten + && game.tasks.includes('FLATTEN_SURROUNDINGS')) { server.send(["TASK:FLATTEN_SURROUNDINGS"]); - } else if (event.key in tui.movement_keys) { + } else if (event.key in tui.movement_keys + && game.tasks.includes('MOVE')) { server.send(['TASK:MOVE', tui.movement_keys[event.key]]); }; } else if (tui.mode == mode_study) {