fix
This commit is contained in:
@@ -20,16 +20,15 @@ use crate::world::VisibleGameEntity;
|
||||
/// Weight of a single log in kg. Enough to encumber a dorf carrying one.
|
||||
pub const LOG_WEIGHT_KG: u32 = 15;
|
||||
|
||||
/// Find the standable surface tile at world XY. Returns the tile one above
|
||||
/// the highest floor tile where an entity can stand, or None if not found.
|
||||
/// Find the standable surface tile at world XY. Returns the floor tile
|
||||
/// where an entity can stand, or None if not found.
|
||||
/// The standable position IS the floor tile itself (has can_stand_in=true),
|
||||
/// not the air above it.
|
||||
fn find_surface_at(world_x: i32, world_y: i32, tilemap: &TileMap) -> Option<IVec3> {
|
||||
for z in -3i32..=4i32 {
|
||||
let floor_pos = IVec3::new(world_x, world_y, z * ITILE_SIZE);
|
||||
if tilemap.floor_tiles.contains_key(&floor_pos) {
|
||||
let above = IVec3::new(world_x, world_y, floor_pos.z + ITILE_SIZE);
|
||||
if tilemap.is_standable(above) {
|
||||
return Some(above);
|
||||
}
|
||||
if tilemap.floor_tiles.contains_key(&floor_pos) && tilemap.is_standable(floor_pos) {
|
||||
return Some(floor_pos);
|
||||
}
|
||||
}
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user