summaryrefslogtreecommitdiff
path: root/src/sim/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/lib')
-rw-r--r--src/sim/lib/force.rs24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/sim/lib/force.rs b/src/sim/lib/force.rs
index 50b5c70..e8f7e90 100644
--- a/src/sim/lib/force.rs
+++ b/src/sim/lib/force.rs
@@ -6,20 +6,16 @@ use crate::sim::{
cell::Cell,
materials::{MaterialId, fire::FireCellView},
},
- cell_sim::world::World,
- particle_sim::{ParticleManager, particle::Particle},
- rb_sim::RbSimManager,
+ particle_manager::particle::Particle,
+ sim_manager::SimManager,
};
pub fn apply_explosion(
+ sim: &mut SimManager,
centre: Vec2,
radius: i32,
force_offset: Vec2,
force_multiplier: f32,
- next_seqno: u64,
- particle_manager: &mut ParticleManager,
- world: &mut World,
- rbsm: &mut RbSimManager,
) {
let get_vel = |pos: Vec2| {
let d = pos.distance(centre);
@@ -38,17 +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) = world.get_cell_from_game_position(ipos.x, ipos.y) {
+ if let Some(cell) = sim.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(next_seqno);
+ fire.match_parity(sim.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 {
- world.set_cell_from_game_position(ipos.x, ipos.y, fire, false);
+ sim.cell_manager
+ .set_cell_from_game_position(ipos.x, ipos.y, fire, false);
} else {
let vel = get_vel(pos);
- particle_manager.particles.push(Particle::new(
+ sim.particle_manager.particles.push(Particle::new(
pos,
vel,
MaterialId::Fire,
@@ -56,10 +53,11 @@ pub fn apply_explosion(
));
}
} else {
- world.set_cell_from_game_position(ipos.x, ipos.y, fire, false);
+ sim.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);
- particle_manager.particles.push(Particle::new(
+ sim.particle_manager.particles.push(Particle::new(
pos,
vel,
cell.material,