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§
Sourcefn is_passable(&self, tileset: T, tile_id: u8) -> bool
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.
Sourcefn collision_type(&self, tileset: T, tile_id: u8) -> CollisionType
fn collision_type(&self, tileset: T, tile_id: u8) -> CollisionType
Returns the full CollisionType for a tile.
Sourcefn is_counter(&self, tileset: T, tile_id: u8) -> bool
fn is_counter(&self, tileset: T, tile_id: u8) -> bool
Returns true if the tile is a counter.
Sourcefn get_grass_tile(&self, tileset: T) -> Option<u8>
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".