Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Plugins/ACsMod.cs
2026-02-13 18:58:35 -03:00

59 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.LuaCs;
namespace Barotrauma
{
[Obsolete("Make your class implement IAssemblyPlugin instead.")]
public abstract class ACsMod : IAssemblyPlugin
{
private static List<ACsMod> mods = new List<ACsMod>();
[Obsolete("$This does nothing. Stop using it!")]
public static List<ACsMod> LoadedMods { get => mods; }
private const string MOD_STORE = "LocalMods/.modstore";
[Obsolete("$This does nothing. Stop using it!")]
public static string GetStoreFolder<T>() where T : ACsMod
{
if (!Directory.Exists(MOD_STORE)) Directory.CreateDirectory(MOD_STORE);
var modFolder = $"{MOD_STORE}/{typeof(T)}";
if (!Directory.Exists(modFolder)) Directory.CreateDirectory(modFolder);
return modFolder;
}
public bool IsDisposed { get; private set; } = false;
/// <summary>
/// Called as soon as plugin loading begins, use this for internal setup only.
/// </summary>
public virtual void Initialize() { }
/// <summary>
/// Called once all plugins have completed Initialization. Put cross-mod code here.
/// </summary>
public virtual void OnLoadCompleted() { }
/// <summary>
/// [NotImplemented] Called before vanilla content is loaded. Use to patch Barotrauma classes before they're
/// instantiated.
/// </summary>
public void PreInitPatching() { }
public virtual void Dispose()
{
try
{
Stop();
}
catch (Exception e)
{
GameMain.LuaCs.Logger.HandleException(e);
}
IsDisposed = true;
}
public abstract void Stop();
}
}