From 011ac432269e1f06babb3965b6809b2ee5bafe47 Mon Sep 17 00:00:00 2001 From: EvilFactory Date: Mon, 3 Oct 2022 13:12:59 -0300 Subject: [PATCH] Fix ForcedAutorun being called two times in some cases --- Barotrauma/BarotraumaShared/Lua/ModLoader.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Lua/ModLoader.lua b/Barotrauma/BarotraumaShared/Lua/ModLoader.lua index 8dffa9d27..cb8a3f385 100644 --- a/Barotrauma/BarotraumaShared/Lua/ModLoader.lua +++ b/Barotrauma/BarotraumaShared/Lua/ModLoader.lua @@ -125,11 +125,13 @@ ProcessPackages( ProcessPackages( ContentPackageManager.LocalPackages, function(pkg, pkgPath) - table.insert(package.path, pkgPath .. LUA_MOD_REQUIRE_PATH) - local forcedAutorunPath = pkgPath .. LUA_MOD_FORCEDAUTORUN_PATH - if File.DirectoryExists(forcedAutorunPath) then - QueueForcedAutorun(forcedAutorunPath, pkgPath, pkg) - executedLocalPackages[pkg.Name] = true + if not executedLocalPackages[pkg.Name] then + table.insert(package.path, pkgPath .. LUA_MOD_REQUIRE_PATH) + local forcedAutorunPath = pkgPath .. LUA_MOD_FORCEDAUTORUN_PATH + if File.DirectoryExists(forcedAutorunPath) then + QueueForcedAutorun(forcedAutorunPath, pkgPath, pkg) + executedLocalPackages[pkg.Name] = true + end end end )