diff --git a/code/modules/tgchat/chat_verbs.dm b/code/modules/tgchat/chat_verbs.dm index 52d423c3d2..29edc5b227 100644 --- a/code/modules/tgchat/chat_verbs.dm +++ b/code/modules/tgchat/chat_verbs.dm @@ -3,4 +3,4 @@ set name = "Export Chatlog" set desc = "Allows to trigger the chat export" - to_chat(usr, "") + tgui_panel.window.send_message("saveToDiskCommand") diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm index 4168cf7c0e..369d98c0af 100644 --- a/code/modules/tgui_panel/tgui_panel.dm +++ b/code/modules/tgui_panel/tgui_panel.dm @@ -72,6 +72,7 @@ /datum/tgui_panel/proc/on_message(type, payload) if(type == "ready") broken = FALSE + window.send_message("connected", list("round_id" = GLOB.round_id)) // Sends the round ID to the chat, requires round IDs window.send_message("update", list( "config" = list( "client" = list( diff --git a/tgui/packages/tgui-panel/chat/middleware.js b/tgui/packages/tgui-panel/chat/middleware.js index 71b351e539..ff82b32b38 100644 --- a/tgui/packages/tgui-panel/chat/middleware.js +++ b/tgui/packages/tgui-panel/chat/middleware.js @@ -160,7 +160,6 @@ export const chatMiddleware = (store) => { settings.visibleMessageLimit, settings.combineMessageLimit, settings.combineIntervalLimit, - settings.logLineCount, settings.logEnable, settings.logLimit, settings.storedTypes, @@ -267,6 +266,10 @@ export const chatMiddleware = (store) => { saveChatToStorage(store); return next(action); } + if (type === 'saveToDiskCommand') { + chatRenderer.saveToDisk(settings.logLineCount); + return; + } if (type === saveChatToDisk.type) { chatRenderer.saveToDisk( settings.logLineCount, diff --git a/tgui/packages/tgui-panel/chat/renderer.jsx b/tgui/packages/tgui-panel/chat/renderer.jsx index c04025bc4f..b66ded8434 100644 --- a/tgui/packages/tgui-panel/chat/renderer.jsx +++ b/tgui/packages/tgui-panel/chat/renderer.jsx @@ -152,7 +152,6 @@ class ChatRenderer { this.visibleMessageLimit = 2500; this.combineMessageLimit = 5; this.combineIntervalLimit = 5; - this.exportLimit = 0; this.logLimit = 0; this.logEnable = true; this.roundId = null; @@ -373,7 +372,6 @@ class ChatRenderer { visibleMessageLimit, combineMessageLimit, combineIntervalLimit, - exportLimit, logEnable, logLimit, storedTypes, @@ -384,7 +382,6 @@ class ChatRenderer { this.visibleMessageLimit = visibleMessageLimit; this.combineMessageLimit = combineMessageLimit; this.combineIntervalLimit = combineIntervalLimit; - this.exportLimit = exportLimit; this.logEnable = logEnable; this.logLimit = logLimit; this.storedTypes = storedTypes; @@ -498,15 +495,6 @@ class ChatRenderer { } else { logger.error('Error: message is missing text payload', message); } - // Get our commands we might want to send to chat - const commands = node.querySelectorAll('[data-command]'); - if (commands.length) { - const command = commands[0].getAttribute('data-command'); - if (command === '$do_export') { - this.saveToDisk(this.exportLimit); - } - return; // We do not want those logged or shown! - } // Get all nodes in this message that want to be rendered like jsx const nodes = node.querySelectorAll('[data-component]'); for (let i = 0; i < nodes.length; i++) { diff --git a/tgui/packages/tgui-panel/game/reducer.ts b/tgui/packages/tgui-panel/game/reducer.ts index 965bfa0cb7..966367e6e5 100644 --- a/tgui/packages/tgui-panel/game/reducer.ts +++ b/tgui/packages/tgui-panel/game/reducer.ts @@ -17,13 +17,21 @@ const initialState = { }; export const gameReducer = (state = initialState, action) => { - const { type, meta } = action; + const { type, meta, payload } = action; if (type === 'roundrestart') { return { ...state, roundRestartedAt: meta.now, }; } + if (type === 'connected') { + if (state.roundId !== payload.round_id) { + return { + ...state, + roundId: payload.round_id, + }; + } + } if (type === connectionLost.type) { return { ...state,