Class ModBehaviour
Inheritance
object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
ModBehaviour
Assembly: Dew.Core.dll
Syntax
public class ModBehaviour : MonoBehaviour
Fields
instance
Declaration
[NonSerialized]
public LoadedModInstance instance
Field Value
Properties
harmony
Declaration
public Harmony harmony { get; }
Property Value
| Type |
Description |
| HarmonyLib.Harmony |
|
mod
Declaration
public ModItem mod { get; }
Property Value
modConfigFields
Declaration
public FieldInfo[] modConfigFields { get; }
Property Value
| Type |
Description |
| System.Reflection.FieldInfo[] |
|
Methods
CallOnManager<T>(Action, Action)
Declaration
public void CallOnManager<T>(Action onEnable, Action onDisable = null) where T : ManagerBase<T>
Parameters
| Type |
Name |
Description |
| System.Action |
onEnable |
|
| System.Action |
onDisable |
|
Type Parameters
CallOnNetworkedManager<T>(Action, Action)
Declaration
public void CallOnNetworkedManager<T>(Action onStartClient, Action onStopClient = null) where T : NetworkedManagerBase<T>
Parameters
| Type |
Name |
Description |
| System.Action |
onStartClient |
|
| System.Action |
onStopClient |
|
Type Parameters
GetConsoleSelectedEntity()
Declaration
protected static Entity GetConsoleSelectedEntity()
Returns
GetModConfigFilePath(FieldInfo)
Declaration
public virtual string GetModConfigFilePath(FieldInfo modConfigInfo)
Parameters
| Type |
Name |
Description |
| System.Reflection.FieldInfo |
modConfigInfo |
|
Returns
LoadConfigsToDisk()
Declaration
public virtual void LoadConfigsToDisk()
MakeSureClientNonServer()
Returns false and logs to console if user is not a non-server client.
Meant to be used in custom console commands.
Declaration
protected static bool MakeSureClientNonServer()
Returns
MakeSureInGame()
Returns false and logs to console if not in a game.
Meant to be used in custom console commands.
Declaration
protected static bool MakeSureInGame()
Returns
MakeSureNetworked()
Returns false and logs to console if not in a networking context.
Meant to be used in custom console commands.
Declaration
protected static bool MakeSureNetworked()
Returns
MakeSureNotInGame()
Returns false and logs to console if in a game.
Meant to be used in custom console commands.
Declaration
protected static bool MakeSureNotInGame()
Returns
MakeSureServer()
Returns false and logs to console if user is not a server.
Meant to be used in custom console commands.
Declaration
protected static bool MakeSureServer()
Returns
OnConfigChanged()
Declaration
public virtual void OnConfigChanged()
PrintNoEntitySelected()
Declaration
protected static void PrintNoEntitySelected()
RegisterConsoleCommand(MethodInfo, string, string)
Register a command by method info. The method can be either static or not.
Command with same name and signature will get a number appended.
The command will be automatically unregistered on mod unload.
Declaration
public void RegisterConsoleCommand(MethodInfo m, string customName = null, string description = null)
Parameters
| Type |
Name |
Description |
| System.Reflection.MethodInfo |
m |
|
| string |
customName |
|
| string |
description |
|
RegisterConsoleCommand(string, string, string)
Register a command by method name. The method can be either static or not.
Command with same name and signature will get a number appended.
The command will be automatically unregistered on mod unload.
Declaration
public void RegisterConsoleCommand(string methodName, string customName = null, string description = null)
Parameters
| Type |
Name |
Description |
| string |
methodName |
|
| string |
customName |
|
| string |
description |
|
SaveConfigsToDisk()
Declaration
public virtual void SaveConfigsToDisk()
TryGetConsoleSelectedEntity(out Entity)
Declaration
protected static bool TryGetConsoleSelectedEntity(out Entity ent)
Parameters
| Type |
Name |
Description |
| Entity |
ent |
|
Returns
Extension Methods