From 65bacddc67942e8678626016960431cdecef2030 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 4 Aug 2023 23:47:39 +1000 Subject: [PATCH] Log missing scripts --- source/game/scripting/StarLuaRoot.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/game/scripting/StarLuaRoot.cpp b/source/game/scripting/StarLuaRoot.cpp index 152bbec..c538df1 100644 --- a/source/game/scripting/StarLuaRoot.cpp +++ b/source/game/scripting/StarLuaRoot.cpp @@ -111,8 +111,14 @@ LuaContext LuaRoot::createContext(StringList const& scriptPaths) { return newContext.engine().createFunctionFromSource(newContext.handleIndex(), source.utf8Ptr(), source.utf8Size(), functionName.utf8Ptr()); })); - for (auto const& scriptPath : scriptPaths) - cache->loadContextScript(newContext, scriptPath); + auto assets = Root::singleton().assets(); + + for (auto const& scriptPath : scriptPaths) { + if (assets->assetExists(scriptPath)) + cache->loadContextScript(newContext, scriptPath); + else + Logger::error("Script '{}' does not exist", scriptPath); + } for (auto const& callbackPair : m_luaCallbacks) newContext.setCallbacks(callbackPair.first, callbackPair.second);