pub trait OverworldCollision {
// Required method
fn is_blocked(&self, x: i32, y: i32) -> bool;
// Provided method
fn is_blocked_at(&self, level: u8, x: i32, y: i32) -> bool { ... }
}Expand description
The minimum a map must answer for the actor to move: is walking onto (x, y)
blocked? Out-of-bounds should return true (enclosed world). Callers fold in
dynamic collision (NPC tiles, locked doors) by composing it into this impl.
Required Methods§
fn is_blocked(&self, x: i32, y: i32) -> bool
Provided Methods§
Sourcefn is_blocked_at(&self, level: u8, x: i32, y: i32) -> bool
fn is_blocked_at(&self, level: u8, x: i32, y: i32) -> bool
Elevation-aware form of is_blocked: is walking onto
(x, y) blocked at elevation level? The default ignores the level
(single-level maps behave exactly as before); multi-level maps override
it to answer from the per-level collision grid.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".