ignore empty.lua and empty scripts (#769)

* ignore empty.lua and empty scripts
and return early if it's an ignored script

* return it else if logic
This commit is contained in:
Aaron Kimbrell 2022-09-04 21:43:16 -05:00 committed by GitHub
parent 14d4bf3cc5
commit c552f46780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -848,17 +848,13 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua")
script = new WblGenericZone();
//Ignore these scripts:
else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua")
script = invalidToReturn;
else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_BASE_ENEMY_SPIDERLING.lua")
script = invalidToReturn;
else if (script == invalidToReturn) {
if (scriptName.length() > 0)
Game::logger->LogDebug("CppScripts", "Attempted to load CppScript for '%s', but returned InvalidScript.", scriptName.c_str());
// handle invalid script reporting if the path is greater than zero and it's not an ignored script
// information not really needed for sys admins but is for developers
script = invalidToReturn;
else if (script == invalidToReturn) {
if ((scriptName.length() > 0) && !((scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua") ||
(scriptName == "scripts\\02_server\\Enemy\\General\\L_BASE_ENEMY_SPIDERLING.lua") ||
(scriptName == "scripts\\empty.lua")
)) Game::logger->LogDebug("CppScripts", "LOT %i attempted to load CppScript for '%s', but returned InvalidScript.", parent->GetLOT(), scriptName.c_str());
}
m_Scripts[scriptName] = script;