using JetBrains.Annotations;
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
///
/// A plugin is a way to register scripts and other components to the script registry.
///
public interface IPlugin
{
///
/// The name of the plugin. Mostly used for debugging purposes.
///
string Name { get; }
///
/// When the plugin should be loaded. Lower values are loaded first.
/// 0 should be reserved for the core battle scripts.
///
uint LoadOrder { get; }
///
/// Run the registration of the plugin when we're building the library.
///
void Register(ScriptRegistry registry);
}
///
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
public abstract class Plugin : IPlugin where TConfiguration : IPluginConfiguration
{
///
/// The configuration for the plugin. This is used to pass in any configuration options.
///
public TConfiguration Configuration { get; }
///
protected Plugin(TConfiguration configuration)
{
Configuration = configuration;
}
///
/// The name of the plugin. Mostly used for debugging purposes.
///
public abstract string Name { get; }
///
/// When the plugin should be loaded. Lower values are loaded first.
/// 0 should be reserved for the core battle scripts.
///
public abstract uint LoadOrder { get; }
///
/// Run the registration of the plugin when we're building the library.
///
public abstract void Register(ScriptRegistry registry);
}
///
/// Base class for plugin configuration.
///
public interface IPluginConfiguration;