Create module subsystem under TShockAPI.Modules

This should allow for TShock.cs to be split up to mini-modules, or "micro-plugins"
This commit is contained in:
Luke 2022-03-05 22:49:52 +10:00
parent d3adc6db42
commit d2a060b76e
3 changed files with 142 additions and 0 deletions

View file

@ -46,6 +46,7 @@ using TShockAPI.Localization;
using TShockAPI.Configuration;
using Terraria.GameContent.Creative;
using System.Runtime.InteropServices;
using TShockAPI.Modules;
namespace TShockAPI
{
@ -149,6 +150,8 @@ namespace TShockAPI
/// </summary>
public static event Action Initialized;
public static ModuleManager ModuleManager { get; } = new ModuleManager();
/// <summary>Version - The version required by the TerrariaAPI to be passed back for checking &amp; loading the plugin.</summary>
/// <value>value - The version number specified in the Assembly, based on the VersionNum variable set in this class.</value>
public override Version Version
@ -421,6 +424,8 @@ namespace TShockAPI
EnglishLanguage.Initialize();
ModuleManager.Initialise(new object[] { this });
if (Config.Settings.RestApiEnabled)
RestApi.Start();
@ -463,6 +468,8 @@ namespace TShockAPI
}
SaveManager.Instance.Dispose();
ModuleManager.Dispose();
ServerApi.Hooks.GamePostInitialize.Deregister(this, OnPostInit);
ServerApi.Hooks.GameUpdate.Deregister(this, OnUpdate);
ServerApi.Hooks.GameHardmodeTileUpdate.Deregister(this, OnHardUpdate);