- Added publicized assemblies to LuaCsForBarotrauma package via ModConfig.xml

- Added XmlAttribute tags for ModConfig.xml defined properties.
- GetType and GetImplementingTypes<T> rework.
This commit is contained in:
MapleWheels
2026-02-09 21:32:57 -05:00
parent fb4648d759
commit 30149b504d
10 changed files with 114 additions and 48 deletions
@@ -6,6 +6,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Xml.Linq;
using System.Xml.Serialization;
using Barotrauma.LuaCs;
using Barotrauma.Steam;
using OneOf;
@@ -44,6 +45,7 @@ public record AssemblyResourceInfo : BaseResourceInfo, IAssemblyResourceInfo
public string FriendlyName { get; init; }
public bool IsScript { get; init; }
public bool UseInternalAccessName { get; init; }
public bool IsReferenceModeOnly { get; init; }
}
/// <summary>
@@ -81,9 +83,12 @@ public record ConfigInfo : IConfigInfo
public record ConfigProfileInfo : IConfigProfileInfo
{
/// <summary>
/// Profile name.
/// </summary>
public string InternalName { get; init; }
public ContentPackage OwnerPackage { get; init; }
public IReadOnlyList<(string ConfigName, XElement Element)> ProfileValues { get; init; }
public IReadOnlyList<(string SettingName, XElement Element)> ProfileValues { get; init; }
}
#endregion
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Xml.Serialization;
namespace Barotrauma.LuaCs.Data;
@@ -24,12 +25,14 @@ public interface IPlatformInfo
/// Platforms that these localization files should be loaded for.
/// </summary>
[Required]
[XmlAttribute("Platform")]
Platform SupportedPlatforms { get; }
/// <summary>
/// Targets that these localization files should be loaded for.
/// </summary>
[Required]
[XmlAttribute("Target")]
Target SupportedTargets { get; }
}
@@ -44,6 +47,7 @@ public interface IResourceInfo : IPlatformInfo
/// Specifies the loading order for all assets of the same type (ie. styles, assemblies, etc.) from
/// the same <see cref="ContentPackage"/>. Lower number is higher priority, see <see cref="System.Linq.Enumerable.OrderBy{TSource,TKey}(IEnumerable{TSource}, Func{TSource,TKey})"/>
/// </summary>
[XmlAttribute("LoadPriority")]
int LoadPriority { get; }
/// <summary>
@@ -56,5 +60,6 @@ public interface IResourceInfo : IPlatformInfo
/// Marks this resource as optional (ie. Cross-CP content). Setting this to true will allow the dependency system to
/// try and order the loading but not fail if it runs into circular dependency issues.
/// </summary>
[XmlAttribute("Optional")]
bool Optional { get; }
}
@@ -5,5 +5,5 @@ namespace Barotrauma.LuaCs.Data;
public interface IConfigProfileInfo : IDataInfo
{
IReadOnlyList<(string ConfigName, XElement Element)> ProfileValues { get; }
IReadOnlyList<(string SettingName, XElement Element)> ProfileValues { get; }
}
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Barotrauma.LuaCs.Data;
@@ -11,6 +12,7 @@ public interface IDataInfo : IEqualityComparer<IDataInfo>, IEquatable<IDataInfo>
/// <summary>
/// Internal name unique within the resources inside a package.
/// </summary>
[XmlAttribute("Name")]
string InternalName { get; }
/// <summary>
/// The package this information belongs to.
@@ -2,6 +2,7 @@
using System.Collections.Immutable;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;
namespace Barotrauma.LuaCs.Data;
@@ -18,6 +19,7 @@ public interface ILuaScriptResourceInfo : IBaseResourceInfo
/// <summary>
/// Should this script be run automatically.
/// </summary>
[XmlAttribute("IsAutorun")]
public bool IsAutorun { get; }
}
@@ -27,17 +29,27 @@ public interface IAssemblyResourceInfo : IBaseResourceInfo
/// The friendly name of the assembly. Script files belonging to the same assembly should all have the same name.
/// Legacy scripts will all be given the sanitized name of the Content Package they belong to.
/// </summary>
[XmlAttribute("FriendlyName")]
public string FriendlyName { get; }
/// <summary>
/// Is this entry referring to a script file collection.
/// </summary>
[XmlAttribute("IsScript")]
public bool IsScript { get; }
/// <summary>
/// <b>[Required(IsScript: true)] Whether the internal compiled assembly name should be named to enabled use of the
/// <see cref="InternalsVisibleToAttribute"/> attribute.</b>
/// </summary>
[XmlAttribute("UseInternalAccessName")]
public bool UseInternalAccessName { get; }
/// <summary>
/// Should the following resources only be used for Compilation MetadataReference.
/// NOTE: Affects the entire package's assembly resources, meant for internal use only.
/// </summary>
[XmlAttribute("IsReferenceModeOnly")]
public bool IsReferenceModeOnly { get; }
}