Added LuaCs package lookup to the info provider.
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
namespace Barotrauma.LuaCs;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Barotrauma.LuaCs;
|
||||||
|
|
||||||
public sealed class LuaCsInfoProvider : ILuaCsInfoProvider
|
public sealed class LuaCsInfoProvider : ILuaCsInfoProvider
|
||||||
{
|
{
|
||||||
@@ -15,4 +19,29 @@ public sealed class LuaCsInfoProvider : ILuaCsInfoProvider
|
|||||||
public bool RestrictMessageSize => GameMain.LuaCs.RestrictMessageSize;
|
public bool RestrictMessageSize => GameMain.LuaCs.RestrictMessageSize;
|
||||||
public string LocalDataSavePath => GameMain.LuaCs.LocalDataSavePath;
|
public string LocalDataSavePath => GameMain.LuaCs.LocalDataSavePath;
|
||||||
public RunState CurrentRunState => GameMain.LuaCs.CurrentRunState;
|
public RunState CurrentRunState => GameMain.LuaCs.CurrentRunState;
|
||||||
|
public ContentPackage LuaCsForBarotraumaPackage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var luaCs = FirstOrDefaultLua(ContentPackageManager.EnabledPackages.All);
|
||||||
|
if (luaCs == null)
|
||||||
|
{
|
||||||
|
luaCs = FirstOrDefaultLua(ContentPackageManager.LocalPackages.Regular);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (luaCs == null)
|
||||||
|
{
|
||||||
|
luaCs = FirstOrDefaultLua(ContentPackageManager.WorkshopPackages.Regular);
|
||||||
|
}
|
||||||
|
|
||||||
|
return luaCs;
|
||||||
|
|
||||||
|
ContentPackage FirstOrDefaultLua(IEnumerable<ContentPackage> packages)
|
||||||
|
{
|
||||||
|
return packages.FirstOrDefault(p =>
|
||||||
|
p.Name.Equals("LuaCsForBarotrauma", StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| p.Name.Equals("Lua for Barotrauma", StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -39,4 +39,9 @@ public interface ILuaCsInfoProvider : IService
|
|||||||
/// The current state of the Execution State Machine.
|
/// The current state of the Execution State Machine.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RunState CurrentRunState { get; }
|
public RunState CurrentRunState { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the best-matching LuaCsForBarotrauma package (enabled list > localMods > WorkshopMods).
|
||||||
|
/// </summary>
|
||||||
|
public ContentPackage LuaCsForBarotraumaPackage { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user