summaryrefslogtreecommitdiff
path: root/src/sim/cell_sim/chunk.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/cell_sim/chunk.rs')
-rw-r--r--src/sim/cell_sim/chunk.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/sim/cell_sim/chunk.rs b/src/sim/cell_sim/chunk.rs
index 116a38a..8c3acb4 100644
--- a/src/sim/cell_sim/chunk.rs
+++ b/src/sim/cell_sim/chunk.rs
@@ -1,6 +1,9 @@
use crate::{
config::{CELLS_IN_CHUNK, CHUNK_SIZE},
- sim::cell::cell::Cell,
+ sim::{
+ cell::{cell::Cell, materials::MaterialId},
+ lib::marching_squares::Marchable,
+ },
};
pub struct Chunk {
@@ -27,3 +30,13 @@ 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 {
+ false
+ } else {
+ self.get_cell_at_local_position(x as u8, y as u8).material != MaterialId::Void
+ }
+ }
+}