diff --git a/webAO/packets/handlers/handleMS.ts b/webAO/packets/handlers/handleMS.ts index 84649427..1c30d55e 100644 --- a/webAO/packets/handlers/handleMS.ts +++ b/webAO/packets/handlers/handleMS.ts @@ -78,7 +78,7 @@ export const handleMS = (args: string[]) => { speed: UPDATE_INTERVAL, }; - if (args.length>16) { + if (args.length > 16) { const extra_cccc = { showname: prepChat(args[16]), other_charid: Number(args[17]), @@ -91,7 +91,7 @@ export const handleMS = (args: string[]) => { }; chatmsg = Object.assign(extra_cccc, chatmsg); - if (args.length>24) { + if (args.length > 24) { const extra_27 = { looping_sfx: Number(args[24]), screenshake: Number(args[25]), @@ -101,7 +101,7 @@ export const handleMS = (args: string[]) => { }; chatmsg = Object.assign(extra_27, chatmsg); - if (args.length>29) { + if (args.length > 29) { const extra_28 = { additive: Number(args[29]), effects: args[30].split("|"), @@ -159,6 +159,8 @@ export const handleMS = (args: string[]) => { if (chatmsg.content.trim() === "") { //blankpost chatmsg.content = ""; + // empty string as chatbox means hide it + chatmsg.chatbox = ""; } // our own message appeared, reset the buttons @@ -169,4 +171,4 @@ export const handleMS = (args: string[]) => { handle_ic_speaking(chatmsg); // no await } } -} \ No newline at end of file +} diff --git a/webAO/viewport/utils/handleICSpeaking.ts b/webAO/viewport/utils/handleICSpeaking.ts index 2cea9260..4fe68d30 100644 --- a/webAO/viewport/utils/handleICSpeaking.ts +++ b/webAO/viewport/utils/handleICSpeaking.ts @@ -15,11 +15,11 @@ import mlConfig from "../../utils/aoml"; const attorneyMarkdown = mlConfig(AO_HOST); export let startFirstTickCheck: boolean; -export const setStartFirstTickCheck = (val: boolean) => {startFirstTickCheck = val} +export const setStartFirstTickCheck = (val: boolean) => { startFirstTickCheck = val } export let startSecondTickCheck: boolean; -export const setStartSecondTickCheck = (val: boolean) => {startSecondTickCheck = val} +export const setStartSecondTickCheck = (val: boolean) => { startSecondTickCheck = val } export let startThirdTickCheck: boolean; -export const setStartThirdTickCheck = (val: boolean) => {startThirdTickCheck = val} +export const setStartThirdTickCheck = (val: boolean) => { startThirdTickCheck = val } /** * Sets a new emote. * This sets up everything before the tick() loops starts @@ -73,7 +73,7 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { const displayname = (document.getElementById("showname")).checked && - client.viewport.getChatmsg().showname !== "" + client.viewport.getChatmsg().showname !== "" ? client.viewport.getChatmsg().showname! : client.viewport.getChatmsg().nameplate!; @@ -91,7 +91,7 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { appendICLog(client.viewport.getChatmsg().content, client.viewport.getChatmsg().showname, client.viewport.getChatmsg().nameplate); checkCallword(client.viewport.getChatmsg().content, client.viewport.getSfxAudio()); - + setEmote( AO_HOST, client, @@ -118,7 +118,7 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { const shoutSprite = ( document.getElementById("client_shout") ); - + const shout = SHOUTS[client.viewport.getChatmsg().objection]; if (shout) { // Hide message box @@ -148,7 +148,7 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { if (client.viewport.getChatmsg().type === 1 && client.viewport.getChatmsg().preanim !== "-") { //we have a preanim chatContainerBox.style.opacity = "0"; - + gifLength = await getAnimLength( `${AO_HOST}characters/${encodeURI( client.viewport.getChatmsg().name!.toLowerCase() @@ -213,13 +213,17 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { setChatbox(client.viewport.getChatmsg().chatbox); resizeChatbox(); + if (client.viewport.getChatmsg().chatbox === "") { + // No chatbox means hide it + chatContainerBox.style.opacity = "0"; + } if (!skipoffset) { // Flip the character charLayers.style.transform = - client.viewport.getChatmsg().flip === 1 ? "scaleX(-1)" : "scaleX(1)"; + client.viewport.getChatmsg().flip === 1 ? "scaleX(-1)" : "scaleX(1)"; pairLayers.style.transform = - client.viewport.getChatmsg().other_flip === 1 ? "scaleX(-1)" : "scaleX(1)"; + client.viewport.getChatmsg().other_flip === 1 ? "scaleX(-1)" : "scaleX(1)"; // Shift by the horizontal offset switch (client.viewport.getChatmsg().side) { @@ -244,9 +248,9 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { client.viewport.blipChannels.forEach( (channel: HTMLAudioElement) => - (channel.src = `${AO_HOST}sounds/blips/${encodeURI( - client.viewport.getChatmsg().blips.toLowerCase() - )}.opus`) + (channel.src = `${AO_HOST}sounds/blips/${encodeURI( + client.viewport.getChatmsg().blips.toLowerCase() + )}.opus`) ); // process markup @@ -293,20 +297,20 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { fg.src = transparentPng; } - + charLayers.style.opacity = "1"; const soundChecks = ["0", "1", "", undefined]; if (soundChecks.some((check) => client.viewport.getChatmsg().sound === check)) { client.viewport.getChatmsg().sound = client.viewport.getChatmsg().effects[2]; } - + try { client.viewport.getChatmsg().parsed = await attorneyMarkdown.applyMarkdown( client.viewport.getChatmsg().content, - + COLORS[client.viewport.getChatmsg().color] - + ); } catch (error) { console.warn("markdown failed"); @@ -319,6 +323,6 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { } client.viewport.getChatmsg().parsed = output; } - + client.viewport.chat_tick(); -}; \ No newline at end of file +};