From 2640f91e36558650bb988dcc82b5148ee71f3eb0 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Tue, 18 Aug 2026 22:22:27 -0700 Subject: optimize with settlement counter --- src/sim/cell_sim/chunk.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/sim/cell_sim/chunk.rs') 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) { -- cgit v1.3.1