diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-08-16 17:29:42 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-08-16 17:29:42 -0700 |
| commit | f177cc716c5f2aa5b50b14ccbb421de89e3a7854 (patch) | |
| tree | db06f9f44251d6d90e5e9709d47e6cc4397b9443 /src/sim/cell/materials/smoke.rs | |
| parent | 40e9d818195824749293dff3afcfdd5c1432adbe (diff) | |
wip
Diffstat (limited to 'src/sim/cell/materials/smoke.rs')
| -rw-r--r-- | src/sim/cell/materials/smoke.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sim/cell/materials/smoke.rs b/src/sim/cell/materials/smoke.rs new file mode 100644 index 0000000..2ee7c00 --- /dev/null +++ b/src/sim/cell/materials/smoke.rs @@ -0,0 +1,20 @@ +use rand::RngExt; + +use crate::sim::cell_sim::sim::UpdateCtx; + +#[inline] +pub fn sim_update(ctx: &mut UpdateCtx) { + // only allow upward movement some of the time to limit movement speed + if ctx.rng.random_range(0.0..1.0) > 0.8 && ctx.candidates_swap(&[(0, -1)]) { + return; + } + // same for each horizontal direction + if ctx.rng.random_range(0.0..1.0) > 0.8 + && ctx.candidates_swap(&[(1 - ctx.seqno_parity as i32 * 2, 0)]) + { + return; + } + if ctx.rng.random_range(0.0..1.0) > 0.8 + && ctx.candidates_swap(&[(-1 + ctx.seqno_parity as i32 * 2, 0)]) + {} +} |
