summaryrefslogtreecommitdiff
path: root/src/sim/materials/smoke.rs
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2026-08-16 00:46:57 -0700
committerKai Stevenson <kai@kaistevenson.com>2026-08-16 00:46:57 -0700
commit24886c2752548f1c32ed54968a7bfdf2b1fe38ea (patch)
treee6ba72311d9c5b39793d3fd1944a4ee4851fd94c /src/sim/materials/smoke.rs
parentd7eccba2055cd7784a0db6d9ee8692a4f3510931 (diff)
fire changes + smoke
Diffstat (limited to 'src/sim/materials/smoke.rs')
-rw-r--r--src/sim/materials/smoke.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/sim/materials/smoke.rs b/src/sim/materials/smoke.rs
new file mode 100644
index 0000000..68f77ca
--- /dev/null
+++ b/src/sim/materials/smoke.rs
@@ -0,0 +1,24 @@
+use rand::RngExt;
+
+use crate::sim::{cell::Cell, materials::MaterialId, 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 {
+ if ctx.candidates_swap(&[(0, -1)]) {
+ return;
+ }
+ }
+ // same for each horizontal direction
+ if ctx.rng.random_range(0.0..1.0) > 0.8 {
+ if ctx.candidates_swap(&[(1 - ctx.seqno_parity as i32 * 2, 0)]) {
+ return;
+ }
+ }
+ if ctx.rng.random_range(0.0..1.0) > 0.8 {
+ if ctx.candidates_swap(&[(-1 + ctx.seqno_parity as i32 * 2, 0)]) {
+ return;
+ }
+ }
+}