X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/balance2?a=blobdiff_plain;ds=sidebyside;f=rogue_chat.html;h=5e663981d13ba7292b0f8b98ca006fde9b8b4a7c;hb=c4a74406fd9fc0f7d91ad428a9c28b5369e5c51a;hp=16a27ba68a4b6739615a506b4497088598d80d44;hpb=79fb5ce7f20c880164d98fd47640e742041e2fd9;p=plomrogue2 diff --git a/rogue_chat.html b/rogue_chat.html index 16a27ba..5e66398 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -539,6 +539,9 @@ let server = { } } else if (tokens[0] === 'CHAT') { tui.log_msg('# ' + tokens[1], 1); + } else if (tokens[0] === 'CHATFACE') { + tui.draw_face = tokens[1]; + tui.full_refresh(); } else if (tokens[0] === 'REPLY') { tui.log_msg('#MUSICPLAYER: ' + tokens[1], 1); } else if (tokens[0] === 'PLAYER_ID') { @@ -701,6 +704,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 +1131,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 +1289,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 +1503,7 @@ document.onclick = function() { }; tui.inputEl.addEventListener('keydown', (event) => { tui.show_help = false; + tui.draw_face = false; if (event.key == 'Enter') { event.preventDefault(); }