Scriptloading overhaul (#163)

* - Added option to RunConfig.cs for mods to compile with non-publicized assemblies.
- Added default values attrib to RunConfig.cs
- Added thread sleeping to CsPackageManager.Dispose() to give time before generating a strong-ref to check acl unload status.

* - Added PrintWarning to ModUtils.cs
- Made previously unloaded ACLs warning only.
- Made plugins unload after lua script disposal.
- Small code cleanups.
- Cleared acl record references on unloading.
- Made ACL unload run via event hook.

* Made non-pub asm compilation name the same long-a** name in XML, as per Evil's request.
This commit is contained in:
MapleWheels
2023-10-24 17:51:48 -04:00
committed by GitHub
parent e984633ca5
commit 9e48dda739
7 changed files with 80 additions and 32 deletions
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Xml.Serialization;
namespace Barotrauma;
@@ -9,12 +10,16 @@ public sealed class RunConfig
/// <summary>
/// How should scripts be run on the server.
/// </summary>
[XmlElement(ElementName = "Server")] public string Server;
[XmlElement(ElementName = "Server")]
[DefaultValue("Standard")]
public string Server;
/// <summary>
/// How should scripts be run on the client.
/// </summary>
[XmlElement(ElementName = "Client")] public string Client;
[XmlElement(ElementName = "Client")]
[DefaultValue("Standard")]
public string Client;
/// <summary>
/// List of dependencies by either Steam Workshop ID or by Partial Inclusive Name (ie. "ModDep" will match a mod named "A ModDependency").
@@ -23,7 +28,14 @@ public sealed class RunConfig
[XmlArrayItem(ElementName = "Dependency", IsNullable = true, Type = typeof(Dependency))]
[XmlArray]
public Dependency[] Dependencies { get; set; }
/// <summary>
/// Compiles the mod using non-publicized assemblies.
/// </summary>
[XmlElement(ElementName = "UseNonPublicizedAssemblies")]
[DefaultValue(false)]
public bool UseNonPublicizedAssemblies { get; set; }
[XmlElement(ElementName = "AutoGenerated")]
public bool AutoGenerated { get; set; }
@@ -33,6 +45,7 @@ public sealed class RunConfig
if (autoGenerated)
{
(Client, Server) = ("Standard", "Standard");
UseNonPublicizedAssemblies = false;
}
}