X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7Bcard_id%7D%7D/form?a=blobdiff_plain;f=rogue_chat.html;h=5a55f3bd1d01254e7531b03762d83508baea4739;hb=01b6b1da2a94fe26d1ad44348afb133edcd2a273;hp=16a27ba68a4b6739615a506b4497088598d80d44;hpb=79fb5ce7f20c880164d98fd47640e742041e2fd9;p=plomrogue2 diff --git a/rogue_chat.html b/rogue_chat.html index 16a27ba..5a55f3b 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -539,6 +539,8 @@ let server = { } } else if (tokens[0] === 'CHAT') { tui.log_msg('# ' + tokens[1], 1); + } else if (tokens[0] === 'CHATFACE') { + tui.draw_face = tokens[1]; } else if (tokens[0] === 'REPLY') { tui.log_msg('#MUSICPLAYER: ' + tokens[1], 1); } else if (tokens[0] === 'PLAYER_ID') { @@ -701,6 +703,7 @@ let tui = { offset: [0,0], map_lines: [], selectables: [], + draw_face: false, init: function() { this.mode_play.available_modes = ["chat", "study", "edit", "admin_enter", "command_thing", "take_thing", "drop_thing"] @@ -1127,6 +1130,27 @@ let tui = { terminal.write(term_y, term_x, to_draw); } }, + draw_face_popup: function() { + const t = game.things[this.draw_face]; + if (!t) { + this.draw_face = false; + return; + } + function draw_body_part(body_part, end_y) { + const start_x = tui.window_width - 10; + terminal.write(end_y - 4, start_x, '+--------+'); + terminal.write(end_y - 3, start_x, '| |'); + terminal.write(end_y - 2, start_x, '| ' + body_part.slice(0, 6) + ' |'); + terminal.write(end_y - 1, start_x, '| ' + body_part.slice(6, 12) + ' |'); + terminal.write(end_y, start_x, '| ' + body_part.slice(12, 18) + ' |'); + } + if (t.face) { + draw_body_part(t.face, terminal.rows - 1); + } + if (t.hat) { + draw_body_part(t.hat, terminal.rows - 4); + } + }, draw_mode_line: function() { let help = 'hit [' + this.keys.help + '] for help'; if (this.mode.has_input_prompt) { @@ -1264,6 +1288,9 @@ let tui = { if (this.show_help) { this.draw_help(); } + if (this.draw_face && ['chat', 'play'].includes(this.mode.name)) { + this.draw_face_popup(); + } if (!this.draw_links) { this.links = {}; } @@ -1475,6 +1502,7 @@ document.onclick = function() { }; tui.inputEl.addEventListener('keydown', (event) => { tui.show_help = false; + tui.draw_face = false; if (event.key == 'Enter') { event.preventDefault(); }