Skip to main content

TileMetadata

Trait TileMetadata 

Source
pub trait TileMetadata<T: TileMetaTrait> {
    // Required methods
    fn is_passable(&self, tileset: T, tile_id: u8) -> bool;
    fn collision_type(&self, tileset: T, tile_id: u8) -> CollisionType;
    fn is_ledge(&self, tileset: T, tile_id: u8) -> bool;
    fn is_counter(&self, tileset: T, tile_id: u8) -> bool;
    fn is_grass(&self, tileset: T, tile_id: u8) -> bool;
    fn get_grass_tile(&self, tileset: T) -> Option<u8>;
}
Expand description

Provides collision and terrain metadata for tiles in a given tileset.

The engine queries this trait whenever an entity attempts to move onto a tile, to determine whether the movement is valid and what special behaviour (if any) should trigger.

Required Methods§

Source

fn is_passable(&self, tileset: T, tile_id: u8) -> bool

Returns true if a tile with the given ID in the given tileset can be walked on freely.

Source

fn collision_type(&self, tileset: T, tile_id: u8) -> CollisionType

Returns the full CollisionType for a tile.

Source

fn is_ledge(&self, tileset: T, tile_id: u8) -> bool

Returns true if the tile is a ledge.

Source

fn is_counter(&self, tileset: T, tile_id: u8) -> bool

Returns true if the tile is a counter.

Source

fn is_grass(&self, tileset: T, tile_id: u8) -> bool

Returns true if the tile is tall grass.

Source

fn get_grass_tile(&self, tileset: T) -> Option<u8>

Returns the special grass tile ID for encounter calculations, or None if the default encounter rate should be used.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§