minor
This commit is contained in:
+2
-2
@@ -200,7 +200,7 @@ pub fn citizen_movement(
|
||||
fn is_valid_move(tilemap: &TileMap, pos: IVec3) -> bool {
|
||||
// Check if the tile at current position is not blocking
|
||||
if let Some(current_tile) = tilemap.floor_tiles.get(&pos) {
|
||||
if current_tile.1 {
|
||||
if current_tile.0 != 0 {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ fn is_valid_move(tilemap: &TileMap, pos: IVec3) -> bool {
|
||||
// Check if there's solid ground below
|
||||
let pos_below = pos - IVec3::new(0, 0, 1);
|
||||
if let Some(below_tile) = tilemap.floor_tiles.get(&pos_below) {
|
||||
return below_tile.1;
|
||||
return below_tile.0 != 0;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ fn main() {
|
||||
tile::camera_z_movement,
|
||||
tile::update_tile_visibility
|
||||
.run_if(|camera_moved: Res<tile::CameraMoved>| camera_moved.0),
|
||||
// log_fps_system,
|
||||
log_fps_system,
|
||||
),
|
||||
)
|
||||
.run();
|
||||
|
||||
+5
-1
@@ -86,7 +86,7 @@ pub fn calculate_visibility(pos: IVec3, tilemap: &TileMap) -> [u32; 8] {
|
||||
|
||||
let mut is_occluded = false;
|
||||
|
||||
'vertical_check: for z_offset in 1..=35 {
|
||||
'vertical_check: for z_offset in 1..5 {
|
||||
let above_pos = IVec3::new(pos.x, pos.y, pos.z + (z_offset * tile_size));
|
||||
if above_pos.z <= camera_z {
|
||||
if let Some(&(_, opaque, _, _, _)) = tilemap.floor_tiles.get(&above_pos) {
|
||||
@@ -95,6 +95,10 @@ pub fn calculate_visibility(pos: IVec3, tilemap: &TileMap) -> [u32; 8] {
|
||||
break 'vertical_check;
|
||||
}
|
||||
}
|
||||
if z_offset >= 4 {
|
||||
is_occluded = true;
|
||||
break 'vertical_check;
|
||||
}
|
||||
// if let Some(&(_, solid, _)) = tilemap.fixtures.get(&above_pos) {
|
||||
// if solid {
|
||||
// is_occluded = true;
|
||||
|
||||
Reference in New Issue
Block a user