From 224ad2c2c07311475875d1d243354f8647112b45 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sat, 29 Jul 2023 02:12:03 +1000 Subject: Reset script panes on character swap --- source/client/StarClientApplication.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'source/client/StarClientApplication.cpp') diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index ab620b4..efbdcad 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -510,10 +510,23 @@ void ClientApplication::changeState(MainAppState newState) { m_universeClient->setLuaCallbacks("input", LuaBindings::makeInputCallbacks()); m_universeClient->setLuaCallbacks("voice", LuaBindings::makeVoiceCallbacks()); - m_universeClient->playerReloadCallback() = [&]() { - if (auto paneManager = m_mainInterface->paneManager()) { - if (auto inventory = paneManager->registeredPane(MainInterfacePanes::Inventory)) - inventory->clearChangedSlots(); + auto heldScriptPanes = make_shared>(); + + m_universeClient->playerReloadPreCallback() = [&, heldScriptPanes](bool resetInterface) { + if (!resetInterface) + return; + + m_mainInterface->takeScriptPanes(*heldScriptPanes); + }; + + m_universeClient->playerReloadCallback() = [&, heldScriptPanes](bool resetInterface) { + auto paneManager = m_mainInterface->paneManager(); + if (auto inventory = paneManager->registeredPane(MainInterfacePanes::Inventory)) + inventory->clearChangedSlots(); + + if (resetInterface) { + m_mainInterface->reviveScriptPanes(*heldScriptPanes); + heldScriptPanes->clear(); } }; -- cgit v1.2.3