Enum Class CollisionFlag
- All Implemented Interfaces:
Serializable, Comparable<CollisionFlag>, Constable
Represents the full set of collision and movement-blocking flags used by the
OSRS tile collision system. Each
CollisionFlag corresponds to a
bitmask value that describes obstacles, walls, decorations, and other movement
restrictions on a tile.
This enum provides:
- Strongly typed access to individual collision flags.
- Utility methods for combining and testing bitmask values.
- Helpers for determining whether a movement direction is walkable between tiles.
The underlying collision system stores all flags as raw integer masks, where each bit indicates the presence of a specific obstruction. This enum acts as a higher-level interface for interpreting those masks.
Example:
int mask = collisionMap[x][y];
if (CollisionFlag.isSet(mask, CollisionFlag.WALL_NORTH)) {
// Tile contains a north wall
}
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionstatic intcombine(CollisionFlag... flags) Combines multipleCollisionFlagvalues into a single integer mask.static EnumSet<CollisionFlag> fromValue(int mask) Converts a raw collision mask into anEnumSetof individual flags.intgetValue()static booleanisAllSet(int mask, CollisionFlag... flags) Checks whether all specified flags are present in the mask.static booleanisAnySet(int mask, CollisionFlag... flags) Checks whether any of the given flags are present in the mask.static booleanisBlocked(int mask) Determines whether a tile is fundamentally blocked for movement.static booleanisDirectionWalkable(Direction dir, int startFlag, int endFlag, boolean ignoreStartBlocked) Determines whether movement in the given direction is allowed based on the start and end tile collision masks.static booleanisSet(int mask, CollisionFlag flag) Checks whether a specific flag is present in the given collision mask.static StringtoString(int mask) Produces a human-readable string listing all flags present in the mask.static CollisionFlagReturns the enum constant of this class with the specified name.static CollisionFlag[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
OCCUPIED
-
OCCUPIED_DECOR
-
BLOCKED
-
UNINITIALIZED
-
IMPENETRABLE
-
WALK_BLOCK_FLAGS
-
WALK_SCENARY
-
BLOCK_NPCS_AND_PLAYERS
-
FREEMAP
-
MULTIWAY
-
NPC_WALK_E
-
NPC_WALK_N
-
NPC_WALK_NE
-
NPC_WALK_NESE
-
NPC_WALK_NESW
-
NPC_WALK_NW
-
NPC_WALK_NWNE
-
NPC_WALK_NWSW
-
NPC_WALK_S
-
NPC_WALK_SE
-
NPC_WALK_SW
-
NPC_WALK_SWSE
-
NPC_WALK_W
-
NPCS_OR_PLAYERS
-
PLAYER_WALK_E
-
PLAYER_WALK_N
-
PLAYER_WALK_NE
-
PLAYER_WALK_NESE
-
PLAYER_WALK_NW
-
PLAYER_WALK_NWNE
-
PLAYER_WALK_NWSW
-
PLAYER_WALK_S
-
PLAYER_WALK_SE
-
PLAYER_WALK_SW
-
PLAYER_WALK_SWSE
-
PLAYER_WALK_W
-
ROOF
-
SQ_BLOCKED
-
VIS_BLOCK_FLAGS
-
VIS_E
-
VIS_E_NON_PC
-
VIS_N
-
VIS_N_NON_PC
-
VIS_S
-
VIS_S_NON_PC
-
VIS_W
-
VIS_W_NON_PC
-
WALL_NORTH
-
WALL_EAST
-
WALL_SOUTH
-
WALL_WEST
-
WALL_NORTH_WEST
-
WALL_NORTH_EAST
-
WALL_SOUTH_EAST
-
WALL_SOUTH_WEST
-
SOLID
-
FOV_NORTH
-
FOV_EAST
-
FOV_SOUTH
-
FOV_WEST
-
FOV_NORTH_EAST
-
FOV_NORTH_WEST
-
FOV_SOUTH_EAST
-
FOV_SOUTH_WEST
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
combine
Combines multipleCollisionFlagvalues into a single integer mask.- Parameters:
flags- the flags to combine- Returns:
- a bitmask containing all provided flags
-
isSet
Checks whether a specific flag is present in the given collision mask.- Parameters:
mask- the raw collision maskflag- the flag to test- Returns:
trueif the flag's bit is set in the mask
-
isAnySet
Checks whether any of the given flags are present in the mask.- Parameters:
mask- the collision bitmaskflags- flags to test- Returns:
trueif at least one flag is set
-
isAllSet
Checks whether all specified flags are present in the mask.- Parameters:
mask- the collision bitmaskflags- flags to test- Returns:
trueif all flags are present
-
isBlocked
public static boolean isBlocked(int mask) Determines whether a tile is fundamentally blocked for movement. This includes objects, decorations, full-tile blockers, and impenetrable tiles.- Parameters:
mask- the collision mask- Returns:
trueif the tile cannot be stepped on
-
fromValue
-
toString
Produces a human-readable string listing all flags present in the mask.- Parameters:
mask- the collision mask- Returns:
- comma-separated list of flag names
-
isDirectionWalkable
public static boolean isDirectionWalkable(Direction dir, int startFlag, int endFlag, boolean ignoreStartBlocked) Determines whether movement in the given direction is allowed based on the start and end tile collision masks. Directional blocking checks walls, diagonal obstructions, and tile-level blocking rules consistent with the OSRS movement system.This method enforces:
- Start and end tiles must not be fully blocked.
- Directional walls must not obstruct movement (e.g., north wall blocks north movement).
- Diagonal movement must not pass through corner-blocked tiles.
- Parameters:
dir- the movement directionstartFlag- collision mask of the origin tileendFlag- collision mask of the destination tileignoreStartBlocked- iftrue, the start tile's blockage is ignored- Returns:
trueif movement in the given direction is permitted
-
getValue
public int getValue()
-