diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-08-22 17:59:19 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-08-22 17:59:19 -0700 |
| commit | 4380928861c2a43f0d0b9793b9e501c720cf5803 (patch) | |
| tree | da6a89e7e9557a66fcfb5f498f5b4dbb8a419dbd /src/sim | |
| parent | 020a67107b0fb78f053fa9f45205c093dfbaaeb3 (diff) | |
default impl for behaviour trait
Diffstat (limited to 'src/sim')
| -rw-r--r-- | src/sim/entity/entities/entity_grenade.rs | 7 | ||||
| -rw-r--r-- | src/sim/entity/mod.rs | 12 | ||||
| -rw-r--r-- | src/sim/lib/force.rs | 10 |
3 files changed, 17 insertions, 12 deletions
diff --git a/src/sim/entity/entities/entity_grenade.rs b/src/sim/entity/entities/entity_grenade.rs index eead416..abc57d9 100644 --- a/src/sim/entity/entities/entity_grenade.rs +++ b/src/sim/entity/entities/entity_grenade.rs @@ -11,13 +11,6 @@ struct GrenadeEntityBehaviour { } impl EntityBehaviour for GrenadeEntityBehaviour { - fn physics_update( - &mut self, - _update_ctx: &mut EntityUpdateCtx, - _ctx: &mut SimCtx, - _delta_time: f32, - ) -> () { - } fn update( &mut self, update_ctx: &mut EntityUpdateCtx, diff --git a/src/sim/entity/mod.rs b/src/sim/entity/mod.rs index c6c350e..555d2c6 100644 --- a/src/sim/entity/mod.rs +++ b/src/sim/entity/mod.rs @@ -46,14 +46,20 @@ impl Marchable for EntityCells { } pub trait EntityBehaviour { - fn update(&mut self, update_ctx: &mut EntityUpdateCtx, ctx: &mut SimCtx, delta_time: f32) - -> (); + fn update( + &mut self, + update_ctx: &mut EntityUpdateCtx, + ctx: &mut SimCtx, + delta_time: f32, + ) -> () { + } fn physics_update( &mut self, update_ctx: &mut EntityUpdateCtx, ctx: &mut SimCtx, delta_time: f32, - ) -> (); + ) -> () { + } } pub struct EntityDef { diff --git a/src/sim/lib/force.rs b/src/sim/lib/force.rs index 8acfa15..ff65fef 100644 --- a/src/sim/lib/force.rs +++ b/src/sim/lib/force.rs @@ -4,7 +4,7 @@ use rand::random_range; use crate::sim::{ cell::{ cell::Cell, - materials::{MaterialId, fire::FireCellView}, + materials::{MaterialForm, MaterialId, fire::FireCellView}, }, particle_manager::particle::Particle, sim_manager::SimCtx, @@ -52,7 +52,13 @@ pub fn apply_explosion( 1.0, )); } - } else { + } else if [ + MaterialForm::Solid, + MaterialForm::Liquid, + MaterialForm::Powder, + ] + .contains(&cell.material.def().form) + { ctx.cell_manager .set_cell_from_game_position(ipos.x, ipos.y, fire, false); if random_range(0.0..1.0) > 0.6 { |
