X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=rogue_chat.html;h=3d17c5a32e172fc8917d3e150827b8bcccec5e37;hb=118102d4306465cfc3215c142c8d13ecff033710;hp=0e20ebca41b1bc563a7bc3481247b557fd4ad8ed;hpb=0f1e35f5f1a318d6e3e610085babd46946ad3600;p=plomrogue2 diff --git a/rogue_chat.html b/rogue_chat.html index 0e20ebc..3d17c5a 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -150,7 +150,7 @@ let mode_helps = { }, 'take_thing': { 'short': 'take thing', - 'intro': '', + 'intro': 'Pick up a thing in reach by entering its index number. Enter nothing to abort.', 'long': 'You see a list of things which you could pick up. Enter the target thing\'s index, or, to leave, nothing.' }, 'admin_thing_protect': { @@ -801,13 +801,29 @@ let tui = { } else if (this.mode.is_single_char_entry) { this.show_help = true; } else if (this.mode.name == 'take_thing') { - this.log_msg("selectable things:"); + this.log_msg("Things in reach for pick-up:"); const player = game.things[game.player_id]; + const y = player.position[0] + const x = player.position[1] + let select_range = [y.toString() + ':' + x.toString(), + (y + 0).toString() + ':' + (x - 1).toString(), + (y + 0).toString() + ':' + (x + 1).toString(), + (y - 1).toString() + ':' + (x).toString(), + (y + 1).toString() + ':' + (x).toString()]; + if (game.map_geometry == 'Hex') { + if (y % 2) { + select_range.push((y - 1).toString() + ':' + (x + 1).toString()); + select_range.push((y + 1).toString() + ':' + (x + 1).toString()); + } else { + select_range.push((y - 1).toString() + ':' + (x - 1).toString()); + select_range.push((y + 1).toString() + ':' + (x - 1).toString()); + } + }; this.selectables = []; for (const t_id in game.things) { const t = game.things[t_id]; - if (t.position[0] == player.position[0] - && t.position[1] == player.position[1] + if (select_range.includes(t.position[0].toString() + + ':' + t.position[1].toString()) && t != player && t.type_ != 'Player') { this.selectables.push([t_id, t]); }