summaryrefslogtreecommitdiff
path: root/src/sim/particle_sim/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/particle_sim/mod.rs')
-rw-r--r--src/sim/particle_sim/mod.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/sim/particle_sim/mod.rs b/src/sim/particle_sim/mod.rs
index 8bad61d..08febfb 100644
--- a/src/sim/particle_sim/mod.rs
+++ b/src/sim/particle_sim/mod.rs
@@ -3,7 +3,10 @@ use glam::{IVec2, Vec2};
use crate::{
config::PIXELS_TO_METRES,
sim::{
- cell::{cell::Cell, materials::MaterialId},
+ cell::{
+ cell::Cell,
+ materials::{MaterialForm, MaterialId},
+ },
cell_sim::world::World,
particle_sim::particle::Particle,
},
@@ -56,7 +59,8 @@ impl ParticleManager {
let mut prev = cur;
if let Some(cell) = world.get_cell_from_game_position(prev.x, prev.y)
- && cell.material != MaterialId::Void
+ && [MaterialForm::Solid, MaterialForm::Powder]
+ .contains(&cell.material.def().form)
{
// already occupied, die
self.particles.swap_remove(i);
@@ -71,7 +75,8 @@ impl ParticleManager {
t_max.y += delta.y;
}
if let Some(cell) = world.get_cell_from_game_position(cur.x, cur.y)
- && cell.material != MaterialId::Void
+ && [MaterialForm::Solid, MaterialForm::Powder]
+ .contains(&cell.material.def().form)
{
// write ourselves to the board
world.set_cell_from_game_position(