diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-08-18 22:22:27 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-08-18 22:22:27 -0700 |
| commit | 2640f91e36558650bb988dcc82b5148ee71f3eb0 (patch) | |
| tree | 5f67c648569109c84736b11b39cb6d2cd6b67e4d /src/sim/cell_sim/chunk.rs | |
| parent | 92dd02d7cc4d9fc930760d26d81edbe2197a3fc0 (diff) | |
optimize with settlement counter
Diffstat (limited to 'src/sim/cell_sim/chunk.rs')
| -rw-r--r-- | src/sim/cell_sim/chunk.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sim/cell_sim/chunk.rs b/src/sim/cell_sim/chunk.rs index c7d619b..85d2c09 100644 --- a/src/sim/cell_sim/chunk.rs +++ b/src/sim/cell_sim/chunk.rs @@ -1,7 +1,10 @@ use crate::{ config::{CELLS_IN_CHUNK, CHUNK_SIZE}, sim::{ - cell::{cell::Cell, materials::MaterialId}, + cell::{ + cell::Cell, + materials::{MaterialForm, MaterialId}, + }, lib::marching_squares::Marchable, }, }; @@ -36,7 +39,9 @@ impl Marchable for Chunk { if x < 0 || x >= CHUNK_SIZE || y < 0 || y >= CHUNK_SIZE { false } else { - self.get_cell_at_local_position(x as u8, y as u8).material != MaterialId::Void + // we only build a path for solid cells or settled powder cells + let cell = self.get_cell_at_local_position(x as u8, y as u8); + cell.material.def().form == MaterialForm::Solid || cell.settled() > 4 } } fn size(&self) -> (i32, i32) { |
