Class ModEntryPoint
Every Assembly can contain one or no ModEntryPoint.
If it does and is listed in the Mod manifest, the entry point will be
instantiated by the mod loader and its OnLoad
method called when
the mod is loaded.
Namespace: Modding
Assembly: Assembly-CSharp.dll
Syntax
public abstract class ModEntryPoint
Constructors
ModEntryPoint()
Declaration
protected ModEntryPoint()
Methods
IsRequiredForLevel(Level)
Called to determine if the mod is a necessary part of a level. If this returns true, a warning will be presented to the user when trying to load the level without the mod installed.
If the method is not overriden, it always returns false.
Note: This is intended for when the mod changes other objects or logic elements such that it will also be necessary to load them correctly again. If the level contains a modded entity or logic element (event or trigger), the corresponding mod will automatically be marked as required, disregarding what this method returns.
Declaration
public virtual bool IsRequiredForLevel(Level editor)
Parameters
Type | Name | Description |
---|---|---|
Level | editor |
Returns
Type | Description |
---|---|
Boolean |
IsRequiredForMachine(PlayerMachineInfo)
Called to determine if the mod is a necessary part of a machine. If this returns true, a warning will be presented to the user when trying to load the machine without the mod installed.
If the method is not overriden, it always returns false.
Note: This is intended for when the mod changes other blocks such that it will also be necessary to load them correctly again. If the machine contains a modded block, the corresponding mod will automatically be marked as required, disregarding what this method returns.
Declaration
public virtual bool IsRequiredForMachine(PlayerMachineInfo machine)
Parameters
Type | Name | Description |
---|---|---|
PlayerMachineInfo | machine | The machine. |
Returns
Type | Description |
---|---|
Boolean | If the mod is required for the machine. |
OnBlockPrefabCreation(Int32, GameObject, GameObject)
Enables customization of block prefabs.
Declaration
public virtual void OnBlockPrefabCreation(int blockId, GameObject prefab, GameObject ghost)
Parameters
Type | Name | Description |
---|---|---|
Int32 | blockId | Local ID of the block |
UnityEngine.GameObject | prefab | Prefab object |
UnityEngine.GameObject | ghost | Ghost object |
Remarks
Called for every block the mod adds, after its prefab has been created. Allows making changes to the prefab and the ghost that are not possible using the XML declarations.
This is called before the OnPrefabCreation method of BlockScript, so when writing the block script you may assume that any changes made here have already been applied.
Note: Unlike OnPrefabCreation of BlockScript, this is called before a block has been fully initialized. Most notably, the block does not have an ID assigned yet, which may lead to unexpected behaviour.
If you encounter such behaviour, try using OnPrefabCreation instead of this!
OnEntityPrefabCreation(Int32, GameObject)
Enables customization of entity prefabs.
Declaration
public virtual void OnEntityPrefabCreation(int entityId, GameObject prefab)
Parameters
Type | Name | Description |
---|---|---|
Int32 | entityId | Local ID of the entity. |
UnityEngine.GameObject | prefab | Prefab object |
Remarks
Called for every entity the mod adds, after its prefab has been created. Allows making changes to the prefab that are not possible using the XML declarations.
OnLoad()
Called when the mod is first loaded.
Declaration
public virtual void OnLoad()
Remarks
Mods marked with the LoadInTitleScreen element are usually loaded when the game is started.
All other mods are only loaded once the the player enters either the multiverse or one of the singleplayer levels.
Note that even mods marked with LoadInTitle can be possibly be loaded later than the first game start, for example if a disabled LoadInTitle mod is enabled in the Multiverse Join screen, it will be loaded then.