-
Notifications
You must be signed in to change notification settings - Fork 0
Doorways API Reference
The Doorways Assembly-wide attribute signals to doorways that the assembly should be loaded as a doorways plug-in. Regardless of what the DLL does, if it does not have this assembly attribute it will not be loaded by Doorways.
Usage
[assembly: Doorways(Name = string, Prefix = string)]
Fields
- string Name: This is the display name Doorways will use for your mod when emitting log messages and error reports. If left unspecified, Doorways will use your Assembly Title.
- string Prefix: This is the ID of your mod. All your mod's content will be prefixed with this string, so it should be kept short. These must be unique - Doorways will not load your mod if another previously loaded Doorways mod has the same prefix. If left unspecified, Doorways will use the full path of the namespace your objects are defined in.
Attach this attribute to any static method in your mod assembly, and Doorways will call it once when your mod is loaded and before Doorways loads any of your mod's content.
There are constraints on the allowed function signature of the tagged method. For more information see Event OnInit.
It is strongly recommended to only tag a single method as your mod init method. However, Doorways will not stop you from defining multiple such methods. In the case that multiple init methods are defined, Doorways will execute them all in an undefined order.
Usage
public class MyModMain
{
[DoorwaysInit]
internal static void Init()
{
// Init code
}
}
Any classes tagged with this attribute will be considered by Doorways to be automatically processed as game entities. In order for them to be added, they must either derive from one of Doorways' base entity classes, or implement IDoorwaysFactory.
If those conditions are satisfied, then Doorways will automatically instantiate the class and add it as a new game entity.
This event is different from all other events in that it cannot be subscribed to. Instead, tell Doorways about your desired Initialization method using the Doorways assembly attribute.
Init functions can have any access level - they are called with reflection which ignores access protections. In fact, it may be better to make your initialization function private
or internal
so other mods cannot call your mod's initialization routine easily.
An init function can either accept no parameters or a single IDoorwaysMod:
internal static void Init();
internal static void Init(IDoorwaysMod mod);