Skip to content

Game.IDisableableProcessor

Assembly: Assembly-CSharp
Namespace: Game.Input

Type: interface

Base: none (interface)

Summary:
Defines a simple interface for input processors that can be enabled/disabled. Implementors expose whether they are allowed to be disabled (canBeDisabled) and their current disabled state (disabled). This is intended for use in the game's input subsystem so processors can be temporarily turned off without being removed from any registration lists. Use the provided constant kDefaultCanBeDisabled as the conventional default behavior for new processors.


Fields

  • const bool kDefaultCanBeDisabled = true
    This constant provides the default value indicating that processors are disableable. Implementations can rely on this constant as a conventional default or override canBeDisabled to return a different value.

Properties

  • bool canBeDisabled { get; }
    Indicates whether this processor can be disabled. Returns true by default (see kDefaultCanBeDisabled). Implementations should return false for processors that must always remain active.

  • bool disabled { get; set; }
    The current disabled state of the processor. Setting this to true should make the processor stop handling input; setting it to false should resume normal handling. The exact behavior and side effects are implementation-defined.

Constructors

  • N/A
    Interfaces do not define constructors. Implementing types are responsible for any initialization.

Methods

  • N/A
    This interface only declares properties and a constant; no methods are defined.

Usage Example

// Example implementation of IDisableableProcessor
public class MyInputProcessor : Game.Input.IDisableableProcessor
{
    // Use the interface constant as the default behavior
    public bool canBeDisabled => Game.Input.IDisableableProcessor.kDefaultCanBeDisabled;

    // Backing field for the disabled state
    private bool m_disabled;
    public bool disabled
    {
        get => m_disabled;
        set
        {
            if (m_disabled == value) return;
            m_disabled = value;

            if (m_disabled)
            {
                // Stop processing input
            }
            else
            {
                // Resume processing input
            }
        }
    }

    // Example method showing how the state might be consulted
    public void ProcessInput(InputEvent evt)
    {
        if (canBeDisabled && disabled) return;

        // Handle the input event
    }
}

Additional notes: - Modders should check canBeDisabled before attempting to toggle disabled; for processors that must remain active, canBeDisabled can return false. - How disabled affects processing is implementation-specific — ensure you document and implement expected side effects (e.g., clear internal state when disabling).