X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/balance?a=blobdiff_plain;f=rogue_chat.html;h=f7a97ec11325cebb6faf66a769209fceea5aae0e;hb=d13e2f639316c1dba7a62d84f3c850bc937c2b1e;hp=0c0cb307c65366d9ff1d6ec0de0c45f55230bf6f;hpb=51addf32b5a876c47325fb55756aacaea65ed0da;p=plomrogue2 diff --git a/rogue_chat.html b/rogue_chat.html index 0c0cb30..f7a97ec 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -57,6 +57,7 @@ keyboard input/control: + @@ -99,6 +100,7 @@ keyboard input/control:
  • drop thing:
  • open/close:
  • consume: +
  • install:
  • @@ -236,6 +238,7 @@ let key_descriptions = { 'drop_thing': 'drop thing', 'door': 'open/close', 'consume': 'consume', + 'install': '(un-)install', 'toggle_map_mode': 'toggle map view', 'toggle_tile_draw': 'toggle protection character drawing', 'hex_move_upleft': 'up-left', @@ -471,6 +474,7 @@ let server = { t.position = parser.parse_yx(tokens[1]); t.type_ = tokens[2]; t.protection = tokens[3]; + t.portable = parseInt(tokens[5]); } else if (tokens[0] === 'THING_NAME') { let t = game.get_thing(tokens[1], false); if (t) { @@ -493,6 +497,11 @@ let server = { if (t) { t.carrying = true; }; + } else if (tokens[0] === 'THING_INSTALLED') { + let t = game.get_thing(tokens[1], false); + if (t) { + t.installed = true; + }; } else if (tokens[0] === 'TERRAIN') { game.terrains[tokens[1]] = tokens[2] } else if (tokens[0] === 'MAP') { @@ -664,6 +673,7 @@ let tui = { 'drop_thing': 'DROP', 'move': 'MOVE', 'door': 'DOOR', + 'install': 'INSTALL', 'command': 'COMMAND', 'consume': 'INTOXICATE', }, @@ -674,7 +684,7 @@ let tui = { this.mode_play.available_modes = ["chat", "study", "edit", "admin_enter", "command_thing", "take_thing"] this.mode_play.available_actions = ["move", "drop_thing", - "teleport", "door", "consume"]; + "teleport", "door", "consume", "install"]; this.mode_study.available_modes = ["chat", "play", "admin_enter", "edit"] this.mode_study.available_actions = ["toggle_map_mode", "move_explorer"]; this.mode_admin.available_modes = ["admin_thing_protect", "control_pw_type", @@ -805,7 +815,7 @@ let tui = { } else if (this.mode.is_single_char_entry) { this.show_help = true; } else if (this.mode.name == 'take_thing') { - this.log_msg("Things in reach for pick-up:"); + this.log_msg("Portable things in reach for pick-up:"); const player = game.things[game.player_id]; const y = player.position[0] const x = player.position[1] @@ -828,7 +838,7 @@ let tui = { const t = game.things[t_id]; if (select_range.includes(t.position[0].toString() + ':' + t.position[1].toString()) - && t != player && t.type_ != 'Player') { + && t.portable) { this.selectables.push([t_id, t]); } }; @@ -1056,7 +1066,7 @@ let tui = { let term_x = Math.max(0, -this.offset[1]); let map_y = Math.max(0, this.offset[0]); let map_x = Math.max(0, this.offset[1]); - for (; term_y < terminal.rows && map_y < game.map_size[0]; term_y++, map_y++) { + for (; term_y < terminal.rows && map_y < this.map_lines.length; term_y++, map_y++) { let to_draw = this.map_lines[map_y].slice(map_x, this.window_width + this.offset[1]); terminal.write(term_y, term_x, to_draw); } @@ -1350,12 +1360,15 @@ let explorer = { get_thing_info: function(t) { const symbol = game.thing_types[t.type_]; let info = t.type_ + " / " + symbol; - if (t.thing_char) { - info += t.thing_char; - }; - if (t.name_) { - info += " (" + t.name_ + ")"; - } + if (t.thing_char) { + info += t.thing_char; + }; + if (t.name_) { + info += " (" + t.name_ + ")"; + } + if (t.installed) { + info += " / installed"; + } return info; }, annotate: function(msg) { @@ -1512,6 +1525,8 @@ tui.inputEl.addEventListener('keydown', (event) => { server.send(["TASK:INTOXICATE"]); } else if (event.key === tui.keys.door && tui.task_action_on('door')) { server.send(["TASK:DOOR"]); + } else if (event.key === tui.keys.install && tui.task_action_on('install')) { + server.send(["TASK:INSTALL"]); } else if (event.key in tui.movement_keys && tui.task_action_on('move')) { server.send(['TASK:MOVE', tui.movement_keys[event.key]]); } else if (event.key === tui.keys.teleport) { @@ -1631,6 +1646,9 @@ document.getElementById("door").onclick = function() { document.getElementById("consume").onclick = function() { server.send(['TASK:INTOXICATE']); }; +document.getElementById("install").onclick = function() { + server.send(['TASK:INSTALL']); +}; document.getElementById("teleport").onclick = function() { game.teleport(); };