Skip to content

Game.Tutorials.PolicyAdjustmentTriggerFlags

Assembly: Assembly-CSharp (game)
Namespace: Game.Tutorials

Type: enum

Base: System.Enum (underlying type: System.Int32)

Summary:
Flags enum used by the tutorial / policy systems to indicate what kind of policy adjustment event occurred. Marked with [Flags], values can be combined to represent multiple simultaneous triggers (for example, Activated | Adjusted). Typical consumers will perform bitwise checks to determine which specific triggers fired.


Fields

  • Activated = 1
    This flag indicates a policy was activated (turned on). Use to detect the transition from off → on.

  • Deactivated = 2
    This flag indicates a policy was deactivated (turned off). Use to detect the transition from on → off.

  • Adjusted = 4
    This flag indicates a policy setting was adjusted (a value or parameter changed) without necessarily toggling activation state.

Properties

  • This enum defines no properties.

Constructors

  • Enums do not define explicit constructors. Instances are created by assigning one of the enum values or a bitwise combination of them.

Methods

  • This enum defines no instance methods. Use standard System.Enum or bitwise operations to work with values (e.g., HasFlag, bitwise &).

Usage Example

// Combine flags when multiple triggers occur
PolicyAdjustmentTriggerFlags triggers = PolicyAdjustmentTriggerFlags.Activated | PolicyAdjustmentTriggerFlags.Adjusted;

// Check for a specific trigger
bool wasActivated = (triggers & PolicyAdjustmentTriggerFlags.Activated) != 0;
// or
bool wasAdjusted = triggers.HasFlag(PolicyAdjustmentTriggerFlags.Adjusted);

// Example in an event handler
void OnPolicyChanged(PolicyAdjustmentTriggerFlags triggers)
{
    if ((triggers & PolicyAdjustmentTriggerFlags.Activated) != 0)
    {
        // handle activation
    }
    if ((triggers & PolicyAdjustmentTriggerFlags.Deactivated) != 0)
    {
        // handle deactivation
    }
    if ((triggers & PolicyAdjustmentTriggerFlags.Adjusted) != 0)
    {
        // handle value adjustments
    }
}

{{ Additional notes: - Because the enum is marked with [Flags], prefer bitwise checks over equality checks when multiple flags may be present. - Values are powers of two (1, 2, 4) to allow safe combination. If new triggers are added in future, ensure they use distinct bit values (8, 16, ...). - When serializing across mod boundaries or saving/loading, treat this as an integer to preserve combined flags consistently. }}