- 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

View File

@@ -36,8 +36,8 @@ namespace Barotrauma
_servicesProvider = SetupServicesProvider();
if (!ValidateLuaCsContent())
{
Logger.LogError($"{nameof(LuaCsSetup)}: ModConfigXml missing. Unable to continue.");
throw new ApplicationException($"{nameof(LuaCsSetup)}: Lua ModConfig.xml is missing. Unable to continue.");
Logger.LogError($"{nameof(LuaCsSetup)}: ModConfig.xml missing. Unable to continue.");
throw new ApplicationException($"{nameof(LuaCsSetup)}: Lua's ModConfig.xml is missing. Unable to continue.");
}
_runStateMachine = SetupStateMachine();
SubscribeToLuaCsEvents();

View File

@@ -151,12 +151,17 @@ public sealed class PackageManagementService : IPackageManagementService
try
{
var res = new FluentResults.Result();
var r = Task.WhenAll(
new Task<Task<FluentResults.Result>>(async Task<FluentResults.Result> () => new FluentResults.Result()
var configsTask = new Task<Task<FluentResults.Result>>(async Task<FluentResults.Result> () =>
new FluentResults.Result()
.WithReasons((await _configService.LoadConfigsAsync(config.Configs)).Reasons)
.WithReasons((await _configService.LoadConfigsProfilesAsync(config.Configs)).Reasons)),
new Task<Task<FluentResults.Result>>(async () => await _luaScriptManagementService.LoadScriptResourcesAsync(config.LuaScripts))
).ConfigureAwait(false).GetAwaiter().GetResult();
.WithReasons((await _configService.LoadConfigsProfilesAsync(config.Configs)).Reasons));
var luaScriptsTask = new Task<Task<FluentResults.Result>>(async () =>
await _luaScriptManagementService.LoadScriptResourcesAsync(config.LuaScripts));
configsTask.Start();
luaScriptsTask.Start();
var r = Task.WhenAll(configsTask, luaScriptsTask).ConfigureAwait(false).GetAwaiter().GetResult();
foreach (var task in r)
res.WithReasons(task.ConfigureAwait(false).GetAwaiter().GetResult().Reasons);

View File

@@ -235,6 +235,7 @@ public sealed class ModConfigService : IModConfigService
private async Task<Result<IModConfigInfo>> CreateFromLegacyAsync(ContentPackage src)
{
// TODO: Implement legacy mod analysis
return new ModConfigInfo()
{
Package = src,