Registering Auxiliary Cyclops Managers - PrimeSonic/PrimeSonicSubnauticaMods GitHub Wiki

The register method for Auxiliary Cyclops Managers is just as simple as all the other registration methods.
In fact, if you already know how to register UpgradeHandlers, then this will all look very familiar.

As before, you have to main ways of Registering.

  1. Pass your own method that returns your aux manager
  2. Pass an object implementing IAuxCyclopsManagerCreator that can create it

For the sake of simplicity, this page will only showcase examples where an anonymous method is passed to Register.AuxCyclopsManager.
For examples of all the other forms you can take, you can follow the same patterns showcase for Icon Overlays and Upgrade Handlers


For this example, let's assume you already have a class defined for use as an auxiliary manager named "MyAuxManager" that already implements the IAuxCyclopsManager interface.

You will be calling into the method MCUServices.Register.AuxCyclopsManager<T>, with T getting replace with your aux manager class ("MyAuxManager" in this example).

Example 1 - Creating a new instance of a simple class

If your aux manager is just a plain class,

internal MyAuxManager : IAuxCyclopsManager
{
   ....
}

you could register it like this and have it constructed when ready:

using MoreCyclopsUpgrades.API;
using MoreCyclopsUpgrades.API.General;

public static MyModPatchMethod()
{
    MCUServices.Register.AuxCyclopsManager<MyAuxManager>((SubRoot cyclops) =>
    {
        return new MyAuxManager(cyclops);
    });
}

Example 2 - Attaching a Unity Monobehavior

If your aux manager is a Unity component,

internal MyAuxManagerMono : Mobobehavior, IAuxCyclopsManager
{
   ....
}

you could register it like this and have it attach when ready:

using MoreCyclopsUpgrades.API;
using MoreCyclopsUpgrades.API.General;

public static MyModPatchMethod()
{
    MCUServices.Register.AuxCyclopsManager<MyAuxManagerMono>((SubRoot cyclops) =>
    {
        return cyclops.AddComponent<MyAuxManagerMono>();
    });
}

These are just examples. You might have very different ideas of what you want to do with your aux manager.
Whatever you choose, remember, that the only real requirement for registering your aux manager is that it can be found or created given a SubRoot reference.