From bdad89910dcf3a56790dba60ed1f0db679432323 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Sat, 22 Aug 2026 16:49:56 -0700 Subject: refactor entities --- src/sim/cell_manager/chunk.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/sim/cell_manager') diff --git a/src/sim/cell_manager/chunk.rs b/src/sim/cell_manager/chunk.rs index 3fe5056..3cf34ff 100644 --- a/src/sim/cell_manager/chunk.rs +++ b/src/sim/cell_manager/chunk.rs @@ -1,3 +1,5 @@ +use glam::IVec2; + use crate::{ config::{CELLS_IN_CHUNK, CHUNK_SIZE}, sim::{ @@ -32,16 +34,16 @@ impl Chunk { } impl Marchable for Chunk { - fn occupied(&self, x: i32, y: i32) -> bool { - if x < 0 || x >= CHUNK_SIZE || y < 0 || y >= CHUNK_SIZE { + fn occupied(&self, pos: IVec2) -> bool { + if pos.x < 0 || pos.x >= CHUNK_SIZE || pos.y < 0 || pos.y >= CHUNK_SIZE { false } else { // 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); + let cell = self.get_cell_at_local_position(pos.x as u8, pos.y as u8); cell.material.def().form == MaterialForm::Solid || cell.settled() > 4 } } - fn size(&self) -> (i32, i32) { - (CHUNK_SIZE, CHUNK_SIZE) + fn size(&self) -> IVec2 { + IVec2::new(CHUNK_SIZE, CHUNK_SIZE) } } -- cgit v1.3.1