Table of Contents

Class EnumExtensions

Namespace
Nautilus.Handlers
Assembly
Nautilus.dll
Extensions to interact more with custom enum objects.
public static class EnumExtensions
Inheritance
EnumExtensions
Inherited Members

Methods

AvoidConflicts(EnumBuilder<Button>)

Assigns this button to force its bindings to work regardless of whether another vanilla button or custom button have similar bindings.
public static EnumBuilder<GameInput.Button> AvoidConflicts(this EnumBuilder<GameInput.Button> builder)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.
See Also

AvoidConflicts(EnumBuilder<Button>, Device)

Assigns this button to force its bindings to work regardless of whether another vanilla button or custom button have similar bindings in a device.
public static EnumBuilder<GameInput.Button> AvoidConflicts(this EnumBuilder<GameInput.Button> builder, GameInput.Device device)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
device GameInput.Device
The devices in which this button avoids conflicts.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.
See Also

CreateCraftTreeRoot(EnumBuilder<Type>, out ModCraftTreeRoot)

Creates a custom crafting tree.
Creating a new CraftTree only makes sense if you're going to use it in a new type of GhostCrafter.
public static EnumBuilder<CraftTree.Type> CreateCraftTreeRoot(this EnumBuilder<CraftTree.Type> builder, out ModCraftTreeRoot craftTreeRoot)

Parameters

builder EnumBuilder<CraftTree.Type>
The custom enum object to make a crafting tree for.
craftTreeRoot ModCraftTreeRoot
The root node for your custom craft tree, as a new ModCraftTreeRoot instance.
Build up your custom crafting tree from this root node.
This tree will be automatically patched into the game.

For more advanced usage, you can replace the default value of CraftTreeCreation with your own custom function.

Returns

EnumBuilder<CraftTree.Type>
A reference to this instance after the operation has completed.

CreateInput(EnumBuilder<Button>, string, string, string, InputActionType)

Initializes the action input for this button.
public static EnumBuilder<GameInput.Button> CreateInput(this EnumBuilder<GameInput.Button> builder, string displayName = "", string tooltip = "", string language = "English", InputActionType actionType = InputActionType.Button)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
displayName string
The display name of the button, can be anything. If null or empty, this will use the language line "Option{enumName}" instead.
tooltip string
The tooltip that's shown once the button is hovered in the Mod Input tab, can be anything. If null or empty, this will use the language line "OptionDesc_{enumName}" instead.
language string
The language for the display name and tooltip. Defaults to English.
actionType InputActionType
Determines the behavior with which an UnityEngine.InputSystem.InputAction triggers.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.
See Also

IsDefinedByDefault<TEnum>(TEnum)

Checks if an enum value is defined by default or added using Nautilus.
public static bool IsDefinedByDefault<TEnum>(this TEnum enumValue) where TEnum : Enum

Parameters

enumValue TEnum
The enum value to look for.

Returns

bool
true if the specified enum value is defined by default, otherwise; false.

Type Parameters

TEnum
The type of the enum.

RegisterToTechGroup(EnumBuilder<TechCategory>, TechGroup)

Registers this TechCategory instance to a TechGroup.
public static EnumBuilder<TechCategory> RegisterToTechGroup(this EnumBuilder<TechCategory> builder, TechGroup techGroup)

Parameters

builder EnumBuilder<TechCategory>
The current custom enum object instance.
techGroup TechGroup
The Tech Group to add this TechCategory to.

Returns

EnumBuilder<TechCategory>
A reference to this instance after the operation has completed.

SetBindable(EnumBuilder<Button>)

Assigns this button to be bindable for all devices in the Mod Input tab.
public static EnumBuilder<GameInput.Button> SetBindable(this EnumBuilder<GameInput.Button> builder)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.

Remarks

By default, all custom buttons are bindable, unless explicitly set as unbindable by calling SetUnbindable(EnumBuilder<Button>).
See Also

SetBindable(EnumBuilder<Button>, Device)

Assigns this button to be bindable for a device in the Mod Input tab.
public static EnumBuilder<GameInput.Button> SetBindable(this EnumBuilder<GameInput.Button> builder, GameInput.Device device)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
device GameInput.Device
The device that was set to be bindable.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.

Remarks

By default, all custom buttons are bindable, unless explicitly set as unbindable by calling SetUnbindable(EnumBuilder<Button>, Device).
See Also

SetUnbindable(EnumBuilder<Button>)

Removes this button from being bindable in the Mod Input tab.
public static EnumBuilder<GameInput.Button> SetUnbindable(this EnumBuilder<GameInput.Button> builder)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.
See Also

SetUnbindable(EnumBuilder<Button>, Device)

Removes this button from being bindable for a specific device in the Mod Input tab.
public static EnumBuilder<GameInput.Button> SetUnbindable(this EnumBuilder<GameInput.Button> builder, GameInput.Device device)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
device GameInput.Device
The device in which this button cannot be bound.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.
See Also

WithBackground(EnumBuilder<BackgroundType>, Sprite)

Adds a sprite for this instance.
public static EnumBuilder<CraftData.BackgroundType> WithBackground(this EnumBuilder<CraftData.BackgroundType> builder, Sprite backgroundSprite)

Parameters

builder EnumBuilder<CraftData.BackgroundType>
The current custom enum object instance
backgroundSprite Sprite
The sprite to add for this instance.

Returns

EnumBuilder<CraftData.BackgroundType>
A reference to this instance after the operation has completed.

Remarks

This overload always registers background icons with a circular background.

WithBackground(EnumBuilder<BackgroundType>, Sprite, bool)

Adds a sprite for this instance.
public static EnumBuilder<CraftData.BackgroundType> WithBackground(this EnumBuilder<CraftData.BackgroundType> builder, Sprite backgroundSprite, bool useCircularIcon)

Parameters

builder EnumBuilder<CraftData.BackgroundType>
The current custom enum object instance
backgroundSprite Sprite
The sprite to add for this instance.
useCircularIcon bool
If true, the 'splice 9' setting will be applied, allowing tall rectangular sprites (usually 2x23) to become circular.

Returns

EnumBuilder<CraftData.BackgroundType>
A reference to this instance after the operation has completed.

WithBinding(EnumBuilder<Button>, Device, BindingSet, string)

Sets the default bindings for this button.
public static EnumBuilder<GameInput.Button> WithBinding(this EnumBuilder<GameInput.Button> builder, GameInput.Device device, GameInput.BindingSet bindingSet, string bindingPath)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
device GameInput.Device
The device this binding is for.
bindingSet GameInput.BindingSet
Whether this is the primary binding or the secondary binding.
bindingPath string
The binding path to bind this button to.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.

Remarks

By default, the binding will be bindable in the Mod Input tab. If you wish to make the button unbindable, consider using SetUnbindable(EnumBuilder<Button>).
See Also

WithBinding(EnumBuilder<Button>, Device, string, string)

Sets the default bindings for this button.
public static EnumBuilder<GameInput.Button> WithBinding(this EnumBuilder<GameInput.Button> builder, GameInput.Device device, string primaryBindingPath, string secondaryBindingPath = null)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
device GameInput.Device
The device this binding is for.
primaryBindingPath string
The binding path to bind the primary hotkey of this button.
secondaryBindingPath string
The binding path to bind the secondary hotkey of this button. If null or empty, the button will have an empty secondary binding.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.

Remarks

By default, the binding will be bindable in the Mod Input tab. If you wish to make the button unbindable, consider using SetUnbindable(EnumBuilder<Button>).
See Also

WithCategory(EnumBuilder<Button>, string)

Defines a custom category in which this button will appear in the Mod Input tab.
public static EnumBuilder<GameInput.Button> WithCategory(this EnumBuilder<GameInput.Button> builder, string category)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
category string
The category name.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.

Remarks

If the specified category was already added by another mod, both buttons will be merged under one category.

WithControllerBinding(EnumBuilder<Button>, string, string)

Sets the default bindings for controller controls for this button.
public static EnumBuilder<GameInput.Button> WithControllerBinding(this EnumBuilder<GameInput.Button> builder, string primaryBindingPath, string secondaryBindingPath = null)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
primaryBindingPath string
The binding path to bind the primary hotkey of this button.
secondaryBindingPath string
The binding path to bind the secondary hotkey of this button. If null or empty, the button will have an empty secondary binding.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.

Remarks

By default, the binding will be bindable in the Mod Input tab. If you wish to make the button unbindable, consider using SetUnbindable(EnumBuilder<Button>).
See Also

WithIcon(EnumBuilder<PingType>, Sprite)

Adds an icon for this instance.
public static EnumBuilder<PingType> WithIcon(this EnumBuilder<PingType> builder, Sprite sprite)

Parameters

builder EnumBuilder<PingType>
The current custom enum object instance.
sprite Sprite
The icon to add for this instance.

Returns

EnumBuilder<PingType>
A reference to this instance after the operation has completed.

WithIcon(EnumBuilder<TechType>, Sprite)

Adds an icon for this instance.
public static EnumBuilder<TechType> WithIcon(this EnumBuilder<TechType> builder, Sprite sprite)

Parameters

builder EnumBuilder<TechType>
The current custom enum object instance.
sprite Sprite
The icon to add for this instance.

Returns

EnumBuilder<TechType>
A reference to this instance after the operation has completed.

WithKeyboardBinding(EnumBuilder<Button>, string, string)

Sets the default bindings for keyboard controls for this button.
public static EnumBuilder<GameInput.Button> WithKeyboardBinding(this EnumBuilder<GameInput.Button> builder, string primaryBindingPath, string secondaryBindingPath = null)

Parameters

builder EnumBuilder<GameInput.Button>
The current custom enum object instance.
primaryBindingPath string
The binding path to bind the primary hotkey of this button.
secondaryBindingPath string
The binding path to bind the secondary hotkey of this button. If null or empty, the button will have an empty secondary binding.

Returns

EnumBuilder<GameInput.Button>
A reference to this instance after the operation has completed.

Remarks

By default, the binding will be bindable in the Mod Input tab. If you wish to make the button unbindable, consider using SetUnbindable(EnumBuilder<Button>).
See Also

WithPdaInfo(EnumBuilder<TechCategory>, string, string)

Adds a display name to this instance.
public static EnumBuilder<TechCategory> WithPdaInfo(this EnumBuilder<TechCategory> builder, string displayName, string language = "English")

Parameters

builder EnumBuilder<TechCategory>
The current enum object instance.
displayName string
The display name of the Tech Category, can be anything. If null or empty, this will use the language line "TechCategory{enumName}" instead.
language string
The language for the display name. Defaults to English.

Returns

EnumBuilder<TechCategory>
A reference to this instance after the operation has completed.

WithPdaInfo(EnumBuilder<TechGroup>, string, string)

Adds a display name to this instance.
public static EnumBuilder<TechGroup> WithPdaInfo(this EnumBuilder<TechGroup> builder, string displayName, string language = "English")

Parameters

builder EnumBuilder<TechGroup>
The current custom enum object instance.
displayName string
The display name of the Tech Group, can be anything. If null or empty, this will use the language line "Group{enumName}" instead.
language string
The language for the display name. Defaults to English.

Returns

EnumBuilder<TechGroup>
A reference to this instance after the operation has completed.

WithPdaInfo(EnumBuilder<TechType>, string, string, string, bool)

Adds a display name, tooltip to this instance.
public static EnumBuilder<TechType> WithPdaInfo(this EnumBuilder<TechType> builder, string displayName, string tooltip, string language = "English", bool unlockAtStart = false)

Parameters

builder EnumBuilder<TechType>
The current custom enum object instance.
displayName string
The display name of this Tech Type, can be anything. If null or empty, this will use the language line "{enumName}" instead.
tooltip string
The tooltip displayed when hovered in the PDA, can be anything. If null or empty, this will use the language line "Tooltip_{enumName}" instead.
language string
The language for this entry. Defaults to English.
unlockAtStart bool
Whether this instance should be unlocked on game start or not.

Returns

EnumBuilder<TechType>
A reference to this instance after the operation has completed.

WithSizeInInventory(EnumBuilder<TechType>, Vector2int)

Sets the size in inventory for this instance.
public static EnumBuilder<TechType> WithSizeInInventory(this EnumBuilder<TechType> builder, Vector2int size)

Parameters

builder EnumBuilder<TechType>
The current custom enum object instance.
size Vector2int
The 2x2 vector size

Returns

EnumBuilder<TechType>
A reference to this instance after the operation has completed.