Skip to content

Class: ModBehaviour ​

  • Namespace: Global
  • Assembly: Dew.Core.dll
csharp
public class ModBehaviour : MonoBehaviour

Fields ​

NameDeclarationDescription
instance`[NonSerialized]
public LoadedModInstance instance`

Properties ​

NameDeclarationDescription
harmonypublic Harmony harmony { get; }
modpublic ModItem mod { get; }
modConfigFieldspublic FieldInfo[] modConfigFields { get; }

Methods ​

CallOnManager<T>(Action, Action) ​

csharp
public void CallOnManager<T>(Action onEnable, Action onDisable = null) where T : ManagerBase<T>

Parameters:

NameTypeDescription
onEnableSystem.Action
onDisableSystem.Action
``T

CallOnNetworkedManager&lt;T&gt;(Action, Action) ​

csharp
public void CallOnNetworkedManager<T>(Action onStartClient, Action onStopClient = null) where T : NetworkedManagerBase<T>

Parameters:

NameTypeDescription
onStartClientSystem.Action
onStopClientSystem.Action
``T

GetConsoleSelectedEntity() ​

csharp
protected static Entity GetConsoleSelectedEntity()

Returns: Entity

GetModConfigFilePath(FieldInfo) ​

csharp
public virtual string GetModConfigFilePath(FieldInfo modConfigInfo)

Parameters:

NameTypeDescription
modConfigInfoSystem.Reflection.FieldInfo

Returns: string

LoadConfigsToDisk() ​

csharp
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.

csharp
protected static bool MakeSureClientNonServer()

Returns: bool

MakeSureInGame() ​

Returns false and logs to console if not in a game.Meant to be used in custom console commands.

csharp
protected static bool MakeSureInGame()

Returns: bool

MakeSureNetworked() ​

Returns false and logs to console if not in a networking context.Meant to be used in custom console commands.

csharp
protected static bool MakeSureNetworked()

Returns: bool

MakeSureNotInGame() ​

Returns false and logs to console if in a game.Meant to be used in custom console commands.

csharp
protected static bool MakeSureNotInGame()

Returns: bool

MakeSureServer() ​

Returns false and logs to console if user is not a server.Meant to be used in custom console commands.

csharp
protected static bool MakeSureServer()

Returns: bool

OnConfigChanged() ​

csharp
public virtual void OnConfigChanged()

PrintNoEntitySelected() ​

csharp
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.

csharp
public void RegisterConsoleCommand(MethodInfo m, string customName = null, string description = null)

Parameters:

NameTypeDescription
mSystem.Reflection.MethodInfo
customNamestring
descriptionstring

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.

csharp
public void RegisterConsoleCommand(string methodName, string customName = null, string description = null)

Parameters:

NameTypeDescription
methodNamestring
customNamestring
descriptionstring

SaveConfigsToDisk() ​

csharp
public virtual void SaveConfigsToDisk()

TryGetConsoleSelectedEntity(out Entity) ​

csharp
protected static bool TryGetConsoleSelectedEntity(out Entity ent)

Parameters:

NameTypeDescription
entEntity

Returns: bool

Maintained by the Shape of Dreams Modding Community