From 020a67107b0fb78f053fa9f45205c093dfbaaeb3 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Sat, 22 Aug 2026 17:52:57 -0700 Subject: entity behavour, grenades --- src/sim/lib/force.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/sim/lib') 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, -- cgit v1.3.1