X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=rogue_chat.html;h=8efe2a2a637c5e55a8d6a634976a514cb7d6001e;hb=6354f0d85ce38a5450142b2bc775e49f0abfc7b8;hp=cc505bc9af9dd1a4909739c0ee40f5e69b6bd4fe;hpb=0d1c7bab88cdc052e3de28a1b1bd67813c721d03;p=plomrogue2 diff --git a/rogue_chat.html b/rogue_chat.html index cc505bc..8efe2a2 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -55,6 +55,7 @@ keyboard input/control: + @@ -105,6 +106,7 @@ keyboard input/control:
  • +
  • @@ -137,6 +139,10 @@ let mode_helps = { 'short': 'name thing', 'long': 'Give name to/change name of thing here.' }, + 'command_thing': { + 'short': 'command thing', + 'long': 'Enter a command to the thing you carry. Enter nothing to return to play mode.' + }, 'admin_thing_protect': { 'short': 'change thing protection', 'long': 'Change protection character for thing here.' @@ -453,6 +459,7 @@ let server = { } else if (tokens[0] === 'TASKS') { game.tasks = tokens[1].split(','); tui.mode_write.legal = game.tasks.includes('WRITE'); + tui.mode_command_thing.legal = game.tasks.includes('WRITE'); } else if (tokens[0] === 'THING_TYPE') { game.thing_types[tokens[1]] = tokens[2] } else if (tokens[0] === 'TERRAIN') { @@ -476,6 +483,8 @@ let server = { tui.full_refresh(); } else if (tokens[0] === 'CHAT') { tui.log_msg('# ' + tokens[1], 1); + } else if (tokens[0] === 'REPLY') { + tui.log_msg('#MUSICPLAYER: ' + tokens[1], 1); } else if (tokens[0] === 'PLAYER_ID') { game.player_id = parseInt(tokens[1]); } else if (tokens[0] === 'LOGIN_OK') { @@ -614,6 +623,7 @@ let tui = { mode_portal: new Mode('portal', true, true), mode_password: new Mode('password', true), mode_name_thing: new Mode('name_thing', true, true), + mode_command_thing: new Mode('command_thing', true), mode_admin_enter: new Mode('admin_enter', true), mode_admin: new Mode('admin'), mode_control_pw_pw: new Mode('control_pw_pw', true), @@ -625,13 +635,15 @@ let tui = { 'drop_thing': 'DROP', 'move': 'MOVE', 'door': 'DOOR', + 'command': 'COMMAND', 'consume': 'INTOXICATE', }, offset: [0,0], map_lines: [], init: function() { this.mode_chat.available_modes = ["play", "study", "edit", "admin_enter"] - this.mode_play.available_modes = ["chat", "study", "edit", "admin_enter"] + this.mode_play.available_modes = ["chat", "study", "edit", "admin_enter", + "command_thing"] this.mode_play.available_actions = ["move", "take_thing", "drop_thing", "teleport", "door", "consume"]; this.mode_study.available_modes = ["chat", "play", "admin_enter", "edit"] @@ -764,6 +776,8 @@ let tui = { } } else if (this.mode.is_single_char_entry) { this.show_help = true; + } else if (this.mode.name == 'command_thing') { + server.send(['TASK:COMMAND', 'HELP']); } else if (this.mode.name == 'admin_enter') { this.log_msg('@ enter admin password:') } else if (this.mode.name == 'control_pw_type') { @@ -1324,6 +1338,14 @@ tui.inputEl.addEventListener('keydown', (event) => { tui.login_name = tui.inputEl.value; server.send(['LOGIN', tui.inputEl.value]); tui.inputEl.value = ""; + } else if (tui.mode.name == 'command_thing' && event.key == 'Enter') { + if (tui.inputEl.value.length == 0) { + tui.log_msg('@ aborted'); + tui.switch_mode('play'); + } else if (tui.task_action_on('command')) { + server.send(['TASK:COMMAND', tui.inputEl.value]); + tui.inputEl.value = ""; + } } else if (tui.mode.name == 'control_pw_pw' && event.key == 'Enter') { if (tui.inputEl.value.length == 0) { tui.log_msg('@ aborted');