From 2b37abf26464faf29dae76705550c36a8103f215 Mon Sep 17 00:00:00 2001 From: EvilFactory Date: Tue, 28 Mar 2023 18:58:22 -0300 Subject: [PATCH] Made this gsub case insensitive so it doesn't break in case the mod's filelist has an incorrect case --- Barotrauma/BarotraumaShared/Lua/ModLoader.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Lua/ModLoader.lua b/Barotrauma/BarotraumaShared/Lua/ModLoader.lua index fcf6c356d..828b56205 100644 --- a/Barotrauma/BarotraumaShared/Lua/ModLoader.lua +++ b/Barotrauma/BarotraumaShared/Lua/ModLoader.lua @@ -78,12 +78,19 @@ end local QueueAutorun = ExecutionQueue() local QueueForcedAutorun = ExecutionQueue() +local function nocase(s) + s = string.gsub(s, "%a", function(c) + return string.format("[%s%s]", string.lower(c), string.upper(c)) + end) + return s +end + local function ProcessPackages(packages, fn) for pkg in packages do if pkg then local pkgPath = pkg.Path :gsub("\\", "/") - :gsub("/filelist.xml", "") + :gsub(nocase("/filelist.xml"), "") fn(pkg, pkgPath) end end @@ -165,7 +172,7 @@ elseif Game.IsMultiplayer then local id = package.UgcId local hash = package.Hash and package.Hash.StringRepresentation or "" - if id == none then id = 0 end + if id == nil then id = 0 end message.WriteString(package.Name) message.WriteString(package.ModVersion)