From e1046dc715b19eb667fb249b952ca70a17d41d82 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sat, 19 Oct 2024 19:15:23 +0200 Subject: [PATCH 1/2] Tell the LuaManager the game has started before the player can be teleported --- apps/openmw/mwstate/statemanagerimp.cpp | 1 - apps/openmw/mwworld/worldimp.cpp | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 4f5ecfc8eb..d9ac2bc654 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -178,7 +178,6 @@ void MWState::StateManager::newGame(bool bypass) MWBase::Environment::get().getWorld()->startNewGame(bypass); mState = State_Running; - MWBase::Environment::get().getLuaManager()->newGameStarted(); MWBase::Environment::get().getWindowManager()->fadeScreenOut(0); MWBase::Environment::get().getWindowManager()->fadeScreenIn(1); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 84f4a6de2c..227c9adfa0 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -353,6 +353,8 @@ namespace MWWorld else mGlobalVariables[Globals::sCharGenState].setInteger(-1); + MWBase::Environment::get().getLuaManager()->newGameStarted(); + if (bypass && !mStartCell.empty()) { ESM::Position pos; From cee373aea8ec062c631ed015fceb828735919766 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sun, 20 Oct 2024 10:50:18 +0200 Subject: [PATCH 2/2] Don't trigger onStateChanged until the game is in a running state --- apps/openmw/mwlua/luamanagerimp.cpp | 1 - apps/openmw/mwstate/statemanagerimp.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwlua/luamanagerimp.cpp b/apps/openmw/mwlua/luamanagerimp.cpp index 144ceb234d..780ddaf9a9 100644 --- a/apps/openmw/mwlua/luamanagerimp.cpp +++ b/apps/openmw/mwlua/luamanagerimp.cpp @@ -373,7 +373,6 @@ namespace MWLua mGlobalScripts.addAutoStartedScripts(); mGlobalScriptsStarted = true; mNewGameStarted = true; - mMenuScripts.stateChanged(); } void LuaManager::gameLoaded() diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index d9ac2bc654..9e292a3eee 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -178,6 +178,7 @@ void MWState::StateManager::newGame(bool bypass) MWBase::Environment::get().getWorld()->startNewGame(bypass); mState = State_Running; + MWBase::Environment::get().getLuaManager()->gameLoaded(); MWBase::Environment::get().getWindowManager()->fadeScreenOut(0); MWBase::Environment::get().getWindowManager()->fadeScreenIn(1);