CharacterFlags - jimdroberts/FishMMO GitHub Wiki
Flags representing various character states and conditions. Used for bitwise state management and quick checks of character status.
-
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.
- Use
CharacterFlags
to represent and check character states using bitwise operations. - Combine multiple flags for complex state management.
// 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
}
- 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.