- Fixed the "deadlock" (tasks not started).

This commit is contained in:
MapleWheels
2026-01-20 07:51:44 -05:00
committed by Maplewheels
parent f1e1b9238d
commit cc07db941f
3 changed files with 13 additions and 7 deletions
@@ -36,8 +36,8 @@ namespace Barotrauma
_servicesProvider = SetupServicesProvider(); _servicesProvider = SetupServicesProvider();
if (!ValidateLuaCsContent()) if (!ValidateLuaCsContent())
{ {
Logger.LogError($"{nameof(LuaCsSetup)}: ModConfigXml missing. Unable to continue."); Logger.LogError($"{nameof(LuaCsSetup)}: ModConfig.xml missing. Unable to continue.");
throw new ApplicationException($"{nameof(LuaCsSetup)}: Lua ModConfig.xml is missing. Unable to continue."); throw new ApplicationException($"{nameof(LuaCsSetup)}: Lua's ModConfig.xml is missing. Unable to continue.");
} }
_runStateMachine = SetupStateMachine(); _runStateMachine = SetupStateMachine();
SubscribeToLuaCsEvents(); SubscribeToLuaCsEvents();
@@ -151,12 +151,17 @@ public sealed class PackageManagementService : IPackageManagementService
try try
{ {
var res = new FluentResults.Result(); var res = new FluentResults.Result();
var r = Task.WhenAll( var configsTask = new Task<Task<FluentResults.Result>>(async Task<FluentResults.Result> () =>
new Task<Task<FluentResults.Result>>(async Task<FluentResults.Result> () => new FluentResults.Result() new FluentResults.Result()
.WithReasons((await _configService.LoadConfigsAsync(config.Configs)).Reasons) .WithReasons((await _configService.LoadConfigsAsync(config.Configs)).Reasons)
.WithReasons((await _configService.LoadConfigsProfilesAsync(config.Configs)).Reasons)), .WithReasons((await _configService.LoadConfigsProfilesAsync(config.Configs)).Reasons));
new Task<Task<FluentResults.Result>>(async () => await _luaScriptManagementService.LoadScriptResourcesAsync(config.LuaScripts)) var luaScriptsTask = new Task<Task<FluentResults.Result>>(async () =>
).ConfigureAwait(false).GetAwaiter().GetResult(); await _luaScriptManagementService.LoadScriptResourcesAsync(config.LuaScripts));
configsTask.Start();
luaScriptsTask.Start();
var r = Task.WhenAll(configsTask, luaScriptsTask).ConfigureAwait(false).GetAwaiter().GetResult();
foreach (var task in r) foreach (var task in r)
res.WithReasons(task.ConfigureAwait(false).GetAwaiter().GetResult().Reasons); res.WithReasons(task.ConfigureAwait(false).GetAwaiter().GetResult().Reasons);
@@ -235,6 +235,7 @@ public sealed class ModConfigService : IModConfigService
private async Task<Result<IModConfigInfo>> CreateFromLegacyAsync(ContentPackage src) private async Task<Result<IModConfigInfo>> CreateFromLegacyAsync(ContentPackage src)
{ {
// TODO: Implement legacy mod analysis
return new ModConfigInfo() return new ModConfigInfo()
{ {
Package = src, Package = src,