diff --git a/source/client/network/ClientCommandHandler.cpp b/source/client/network/ClientCommandHandler.cpp index 6dd365057..a0369121b 100644 --- a/source/client/network/ClientCommandHandler.cpp +++ b/source/client/network/ClientCommandHandler.cpp @@ -278,7 +278,8 @@ void ClientCommandHandler::setupCallbacks() { }); m_client.setCommandCallback(Network::Command::BlockGUIData, [this](Network::Packet &packet) { - gk::ApplicationStateStack::getInstance().push(*this, m_player, m_world, packet, &gk::ApplicationStateStack::getInstance().top()); + if (!LuaGUIState::isActive) + gk::ApplicationStateStack::getInstance().push(*this, m_player, m_world, packet, &gk::ApplicationStateStack::getInstance().top()); }); m_client.setCommandCallback(Network::Command::BlockInvUpdate, [this](Network::Packet &packet) { diff --git a/source/client/states/LuaGUIState.cpp b/source/client/states/LuaGUIState.cpp index 6c5d3df98..4feacefdd 100644 --- a/source/client/states/LuaGUIState.cpp +++ b/source/client/states/LuaGUIState.cpp @@ -46,6 +46,8 @@ #include "ScrollBarWidget.hpp" #include "TextButton.hpp" +bool LuaGUIState::isActive = false; + LuaGUIState::LuaGUIState(ClientCommandHandler &client, ClientPlayer &player, ClientWorld &world, sf::Packet &packet, gk::ApplicationState *parent) : InterfaceState(parent), m_client(client), m_player(player), m_world(world) { @@ -62,6 +64,8 @@ LuaGUIState::LuaGUIState(ClientCommandHandler &client, ClientPlayer &player, Cli while (!packet.endOfPacket()) loadGUI(packet); + + isActive = true; } void LuaGUIState::onEvent(const SDL_Event &event) { @@ -75,6 +79,8 @@ void LuaGUIState::onEvent(const SDL_Event &event) { gk::Mouse::setCursorVisible(false); gk::Mouse::resetToWindowCenter(); + isActive = false; + m_stateStack->pop(); } diff --git a/source/client/states/LuaGUIState.hpp b/source/client/states/LuaGUIState.hpp index 9b3204b8c..eefd94a90 100644 --- a/source/client/states/LuaGUIState.hpp +++ b/source/client/states/LuaGUIState.hpp @@ -48,6 +48,8 @@ class LuaGUIState : public InterfaceState { void update() override; + static bool isActive; + private: void draw(gk::RenderTarget &target, gk::RenderStates states) const override;