diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-08-22 17:52:57 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-08-22 17:52:57 -0700 |
| commit | 020a67107b0fb78f053fa9f45205c093dfbaaeb3 (patch) | |
| tree | 1e970cba6f94e053db284a8394b9a9790a359f77 /src/sim/lib/force.rs | |
| parent | bdad89910dcf3a56790dba60ed1f0db679432323 (diff) | |
entity behavour, grenades
Diffstat (limited to 'src/sim/lib/force.rs')
| -rw-r--r-- | src/sim/lib/force.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/sim/lib/force.rs b/src/sim/lib/force.rs index e8f7e90..8acfa15 100644 --- a/src/sim/lib/force.rs +++ b/src/sim/lib/force.rs @@ -7,11 +7,11 @@ use crate::sim::{ materials::{MaterialId, fire::FireCellView}, }, particle_manager::particle::Particle, - sim_manager::SimManager, + sim_manager::SimCtx, }; pub fn apply_explosion( - sim: &mut SimManager, + ctx: &mut SimCtx, centre: Vec2, radius: i32, force_offset: Vec2, @@ -34,18 +34,18 @@ pub fn apply_explosion( // if there's a cell, convert it to a particle let pos = Vec2::new(centre.x + x as f32, centre.y + y as f32); let ipos = pos.round().as_ivec2(); - if let Some(cell) = sim.cell_manager.get_cell_from_game_position(ipos.x, ipos.y) { + if let Some(cell) = ctx.cell_manager.get_cell_from_game_position(ipos.x, ipos.y) { let mut fire = Cell::from_material(MaterialId::Fire); fire.set_ticks_lived(300); - fire.match_parity(sim.cell_manager.seqno); + fire.match_parity(ctx.cell_manager.seqno); if cell.material == MaterialId::Void && random_range(0.0..1.0) > 0.5 { if random_range(0.0..1.0) > 0.1 { - sim.cell_manager + ctx.cell_manager .set_cell_from_game_position(ipos.x, ipos.y, fire, false); } else { let vel = get_vel(pos); - sim.particle_manager.particles.push(Particle::new( + ctx.particle_manager.particles.push(Particle::new( pos, vel, MaterialId::Fire, @@ -53,11 +53,11 @@ pub fn apply_explosion( )); } } else { - sim.cell_manager + ctx.cell_manager .set_cell_from_game_position(ipos.x, ipos.y, fire, false); if random_range(0.0..1.0) > 0.6 { let vel = get_vel(pos); - sim.particle_manager.particles.push(Particle::new( + ctx.particle_manager.particles.push(Particle::new( pos, vel, cell.material, |
