From a216e61a00bde792a49a92593012f9baecf86f3d Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Fri, 21 Aug 2026 00:14:10 -0700 Subject: explosions --- src/sim/cell/materials/fire.rs | 9 +++++---- src/sim/cell/materials/mod.rs | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/sim/cell') diff --git a/src/sim/cell/materials/fire.rs b/src/sim/cell/materials/fire.rs index dd1ff8c..f582a0c 100644 --- a/src/sim/cell/materials/fire.rs +++ b/src/sim/cell/materials/fire.rs @@ -5,7 +5,7 @@ use crate::sim::{ cell_sim::sim::UpdateCtx, }; -trait FireCellView { +pub trait FireCellView { fn get_ticks_lived(self) -> u16; fn set_ticks_lived(&mut self, ticks: u16) -> (); fn is_flammable(self) -> bool; @@ -31,12 +31,13 @@ pub fn sim_update(ctx: &mut UpdateCtx) { let ticks_lived = ctx.cell.get_ticks_lived(); // 2 seconds if ticks_lived > 240 { - // we have a chance to live longer--roughly 50% chance of living an extra second - if ctx.rng.random_range(0.0..1.0) > 0.995 { + // we have a chance to live longer--roughly ?% chance of living an extra second + if ctx.rng.random_range(0.0..1.0) > 0.9 { // kill ourselves, with a chance to turn into ash + ctx.do_rewrite = false; if ctx.rng.random_range(0.0..1.0) > 0.8 { // TODO ash material - ctx.set_cell(0, 0, Cell::from_material(MaterialId::Sand)); + // ctx.set_cell(0, 0, Cell::from_material(MaterialId::Sand)); } else { ctx.set_cell(0, 0, Cell::void()); } diff --git a/src/sim/cell/materials/mod.rs b/src/sim/cell/materials/mod.rs index 9bcf5e4..e2b5fc6 100644 --- a/src/sim/cell/materials/mod.rs +++ b/src/sim/cell/materials/mod.rs @@ -1,9 +1,9 @@ use crate::sim::cell_sim::sim::UpdateCtx; -mod fire; -mod gas; -mod liquid; -mod powder; +pub mod fire; +pub mod gas; +pub mod liquid; +pub mod powder; #[repr(u8)] #[derive(Clone, Copy, PartialEq, Eq, Debug)] -- cgit v1.3.1