Skip to content

Registering a Standalone Cyclops Status Icon

PrimeSonic edited this page Mar 26, 2021 · 1 revision

Introduced in the 5.2 update, you can now create status icons just like the Cyclops Chargers without having to make an actual charger.

Make sure you've read Creating a Standalone Cyclops Status Icon first!

Similar to Registering Upgrade Handlers,
you will use the MCUServices class provided by MoreCyclopsUpgrades to register your status icon with the API.

Option 1: Register using a Lamda expression (anonymous method)

using MoreCyclopsUpgrades.API;

namespace MyMod
{
    // Your main patching class must have the QModCore attribute (and must be public)
    [QModCore]
    public static class MyInitializerClass
    {
        // Your patching method must have the QModPatch attribute (and must be public)
        [QModPatch]
        public static void MyInitializationMethod()
        {
            MCUServices.Register.CyclopsStatusIcon<MySubStatus>((SubRoot cyclops) => new MySubStatus(cyclops));
        }
    }
}

Option 2: Register using a named method

using MoreCyclopsUpgrades.API;

namespace MyMod
{
    // Your main patching class must have the QModCore attribute (and must be public)
    [QModCore]
    public static class MyInitializerClass
    {
        // Your patching method must have the QModPatch attribute (and must be public)
        [QModPatch]
        public static void MyInitializationMethod()
        {
            MCUServices.Register.CyclopsStatusIcon<MySubStatus>(GetNewStatusIndicator);
        }
    }

    internal static MySubStatus GetNewStatusIndicator(SubRoot cyclops)
    {
        return new MySubStatus(cyclops)
    }
}

Option 3: Register using a class with the ICyclopsStatusIconCreator interface

using MoreCyclopsUpgrades.API;

namespace MyMod
{
    internal class MyStatusIconMaker : ICyclopsStatusIconCreator
    {
        public CyclopsStatusIcon GetNewStatusIndicator(SubRoot cyclops)
        {
            return new MySubStatus(cyclops)
        }
    }

    // Your main patching class must have the QModCore attribute (and must be public)
    [QModCore]
    public static class MyInitializerClass
    {
        // Your patching method must have the QModPatch attribute (and must be public)
        [QModPatch]
        public static void MyInitializationMethod()
        {
            MCUServices.Register.CyclopsStatusIcon<MySubStatus>(MyStatusIconMaker);
        }
    }
}
Clone this wiki locally