summaryrefslogtreecommitdiff
path: root/src/sim/cell_manager
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2026-08-22 16:49:56 -0700
committerKai Stevenson <kai@kaistevenson.com>2026-08-22 16:49:56 -0700
commitbdad89910dcf3a56790dba60ed1f0db679432323 (patch)
tree19e65e2d0e9fa4a6227abc71ef28a6dd622161f0 /src/sim/cell_manager
parent1a515237afb7ad09353a65f5fbc6e98a7c29ce8e (diff)
refactor entities
Diffstat (limited to 'src/sim/cell_manager')
-rw-r--r--src/sim/cell_manager/chunk.rs12
1 files changed, 7 insertions, 5 deletions
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)
}
}