CharacterFlags - jimdroberts/FishMMO GitHub Wiki

Description

Flags representing various character states and conditions. Used for bitwise state management and quick checks of character status.


API Access

Fields

  • Idle = 0

    Character is idle and not performing any actions.

  • IsMoving

    Character is moving.

  • IsRunning

    Character is running.

  • IsCrouching

    Character is crouching.

  • IsSwimming

    Character is swimming.

  • IsTeleporting

    Character is teleporting.

  • IsFrozen

    Character is frozen and cannot move.

  • IsStunned

    Character is stunned and unable to act.

  • IsMesmerized

    Character is mesmerized and unable to act.

  • IsInInstance

    Character is currently inside an instance.


Basic Usage

Setup

  1. Use CharacterFlags to represent and check character states using bitwise operations.
  2. Combine multiple flags for complex state management.

Example

// Example 1: Setting a character flag
character.Flags |= (int)CharacterFlags.IsRunning;

// Example 2: Checking if a character is stunned
if ((character.Flags & (int)CharacterFlags.IsStunned) != 0) {
    // Character is stunned
}

Best Practices

  • Use bitwise operations to efficiently manage and check multiple character states.
  • Always document new flags added to the enum for clarity.
  • Use clear, descriptive names for each flag to avoid confusion.
  • Reset or clear flags as needed to maintain accurate state.
⚠️ **GitHub.com Fallback** ⚠️