Skip to content

Mod Loader

SanicBTW edited this page Oct 11, 2024 · 2 revisions

Introduction

The Mod Loader is obviously the core of a modding framework itself, in this one, you can customize the loader in any way you want, since its modular, you can learn about the framework modularity in its own wiki page.

Usage

The usage of the Mod Loader is pretty easy, you just create a new instance of it and you have everything running already! But of course it allows you to change some parameters from it and modify the behaviour, let's get to the parameters:

  • folder this tells the mod loader WHICH folder to scan for mods but here's a catch, it's forced to the application OUTPUT directory (AppDomain.CurrentDomain.BaseDirectory).
  • filePrefix quick filter for the loading process inside the given engine, for example: Indexer.Format will only load the files that start with that given name (duh).
  • engine the Modding Engine the Mod Loader will use, defaults to the Assembly Engine, it will handle the folder and filePrefix accordingly.
  • config the Configuartion Provider used by the Mod Registry inside the Modding Engine, useful for saving configuration from them and loading it up, currently used for saving the enabled/disabled mods.

Warning

One thing you should never forget is to ALWAYS register the Overridable Classes BEFORE creating the Mod Loader, if you do, then there won't be any Overridable Classes for when the Mod Loader is loading the mods from the respective Modding Engine.

The end

Once you create a new Mod Loader, it will automatically apply Hot Reload Events to the Event Manager.

With this you're ready to go to the next topic, the Event Manager.

Fun Fact

RegisterOverridableClasses (if you don't know what this does, check the wiki page) is also executed whenever it loads a mod using the Assembly Engine.

This is totally intended behaviour, but kind of unnecessary if you ask me, this allows mods to create their own Overridable Classes, but of what use if they CAN'T communicate with each other, like get the classes inside of each one of them, if I'm able to think of a usage of it, I'll move this to another page explaining the usage of it, for now it's not really useful, you can check the PoC code for it here

NuGet Version NuGet Version

Functionality

Structure

  • WIP

Migration

Clone this wiki locally