Class ResoniteMonkey<TMonkey>
- Namespace
- MonkeyLoader.Resonite
- Assembly
- MonkeyLoader.Resonite.Integration.dll
Represents the base class for patchers that run after Resonite's assemblies have been loaded and that hook into the game's lifecycle.
public abstract class ResoniteMonkey<TMonkey> : Monkey<TMonkey>, IResoniteMonkey, IMonkey, IRun, IShutdown, IComparable<IMonkey>, INestedIdentifiable<Mod>, INestedIdentifiable, IIdentifiable, IAuthorable where TMonkey : ResoniteMonkey<TMonkey>, new()
Type Parameters
TMonkey
The type of the actual patcher.
- Inheritance
-
MonkeyBase<TMonkey>Monkey<TMonkey>ResoniteMonkey<TMonkey>
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Game assemblies and their types can be directly referenced from these.
Contains useful overridable methods that are hooked to different points in the game's lifecycle.
Constructors
ResoniteMonkey()
Allows creating only a single TMonkey
instance.
protected ResoniteMonkey()
Properties
EngineInitFailed
Gets whether this ResoniteMonkey failed when OnEngineReady() was called.
public bool EngineInitFailed { get; }
Property Value
EngineInitRan
Gets whether this ResoniteMonkey's OnEngineInit() method has been called.
public bool EngineInitRan { get; }
Property Value
EngineReadyFailed
Gets whether this ResoniteMonkey failed when OnEngineReady() was called.
public bool EngineReadyFailed { get; }
Property Value
EngineReadyRan
Gets whether this ResoniteMonkey's OnEngineReady() method has been called.
public bool EngineReadyRan { get; }
Property Value
Methods
OnEngineInit()
Override this method to be called when the FrooxEngine.Engine's Initialize() method has just been called.
This method can be used if elements of the initialization need to be modified,
such as changing TotalFixedPhaseCount.
Return true
if patching was successful.
protected virtual bool OnEngineInit()
Returns
- bool
Whether the patching was successful.
Remarks
Override OnLoaded() to patch before anything is initialized, or OnEngineReady() to patch when basic facilities of the game are ready to use, while most other code hasn't been run yet.
By default: Doesn't do anything except returntrue
.
OnEngineReady()
Override this method to be called when the FrooxEngine.Engine is ready.
This is the primary method for patching used by Resonite Mods as basic facilities of the game
are ready to use, while most other code hasn't been run yet.
Return true
if patching was successful.
protected virtual bool OnEngineReady()
Returns
- bool
Whether the patching was successful.
Remarks
Override OnLoaded() to patch before anything is initialized,
but strongly consider also overriding this method if you do that.
Otherwise your patches will be applied twice, if you're using [HarmonyLib.HarmonyPatchCategory(nameof(MyPatcher))]
attributes.
Easy to apply by using
[HarmonyLib.HarmonyPatchCategory(nameof(MyPatcher))]
attribute.
OnEngineShutdownRequested(string)
Override this method to be called when the FrooxEngine.Engine is requested to shutdown.
protected virtual void OnEngineShutdownRequested(string reason)
Parameters
reason
stringThe reason for the shutdown request. Seems to always be
Quitting
.
OnLoaded()
Called right after the game tooling packs and all the game's assemblies have been loaded.
Use this to apply any patching and return true
if it was successful.
protected override bool OnLoaded()
Returns
- bool
true
if it ran successfully; otherwise,false
.
Remarks
Override this method if you need to patch something involved in the initialization of the game.
For ResoniteMonkeys, the default behavior ofOnLoaded()
is moved to OnEngineReady().
Otherwise your patches will be applied twice, if you're using
[HarmonyLib.HarmonyPatchCategory(nameof(MyPatcher))]
attributes.
By default: Doesn't do anything except return true
.