From 297f6a38cbed9233382b7e7246b66c7a8cba2480 Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Mon, 26 Jan 2026 19:02:53 -0300 Subject: [PATCH] Basic legacy Lua converter --- .../Services/Processing/ModConfigService.cs | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/Processing/ModConfigService.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/Processing/ModConfigService.cs index a58c47f13..279a4f31c 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/Processing/ModConfigService.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/Processing/ModConfigService.cs @@ -225,13 +225,40 @@ public sealed class ModConfigService : IModConfigService private async Task> CreateFromLegacyAsync(ContentPackage src) { - // TODO: Implement legacy mod analysis - return new ModConfigInfo() - { - Package = src, - Assemblies = ImmutableArray.Empty, - Configs = ImmutableArray.Empty, - LuaScripts = ImmutableArray.Empty + List luaScripts = new List(); + + if (_storageService.DirectoryExists(Path.Combine(src.Path, "Lua", "Autorun")) is { IsSuccess: true, Value: true }) + { + var result = _storageService.FindFilesInPackage(src, "Lua/Autorun", "*.lua", true); + if (result.IsSuccess) + { + List contentPaths = new List(); + + foreach (var path in result.Value) + { + contentPaths.Add(ContentPath.FromRaw(src, $"%ModDir%/{Path.GetFullPath(path, src.Dir)}")); + } + + luaScripts.Add(new LuaScriptsResourceInfo() + { + IsAutorun = true, + SupportedPlatforms = Platform.Any, + SupportedTargets = Target.Any, + InternalName = "legacy", + OwnerPackage = src, + IncompatiblePackages = ImmutableArray.Empty, + RequiredPackages = ImmutableArray.Empty, + FilePaths = contentPaths.ToImmutableArray() + }); + } + } + + return new ModConfigInfo() + { + Package = src, + Assemblies = ImmutableArray.Empty, + Configs = ImmutableArray.Empty, + LuaScripts = luaScripts.ToImmutableArray() }; } }