Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new SMOKE particle/material to the simulation and adjusts related rising/fire behaviors, while also tuning a few fluid/fire interactions for performance/behavior.
Changes:
- Introduces
SMOKEas a new particle ID, color entry, and archetype. - Updates rising-system logic so fire can produce smoke and smoke behaves like gas (shared rising logic); adds additional fire drift/chaos behavior and tweaks cloud water spawning.
- Tweaks liquid lateral spread scaling and makes water’s fire-extinguish pass probabilistic to reduce overhead.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sim/systems/rising.ts | Adds SMOKE handling in rising physics; adjusts fire movement and cloud water spawning behavior. |
| src/sim/systems/liquid.ts | Tunes hydrostatic pressure cap and lateral spread range. |
| src/sim/systems/falling.ts | Makes water extinguishing adjacent fire probabilistic to reduce per-tick work. |
| src/sim/constants.ts | Adds SMOKE numeric ID and a color entry. |
| src/sim/archetypes.ts | Adds SMOKE archetype; adjusts CLOUD archetype properties. |
Comments suppressed due to low confidence (1)
src/sim/constants.ts:25
SMOKEwas added as a new type ID, but theMaterialunion andMATERIAL_TO_IDmapping are not updated to include a'smoke'entry. This makes the constants/API inconsistent and prevents smoke from being representable via the material/tool typing and ID lookup (e.g., worker input painting). Add'smoke'toMaterialand map it toSMOKEinMATERIAL_TO_ID(and keep any UI/tool lists in sync).
export const SMOKE = 68
export type Material = 'empty' | 'sand' | 'water' | 'dirt' | 'stone' | 'plant' | 'fire' | 'gas' | 'fluff' | 'bug' | 'plasma' | 'nitro' | 'glass' | 'lightning' | 'slime' | 'ant' | 'alien' | 'quark' | 'crystal' | 'ember' | 'static' | 'bird' | 'gunpowder' | 'tap' | 'anthill' | 'bee' | 'flower' | 'hive' | 'honey' | 'nest' | 'gun' | 'cloud' | 'acid' | 'lava' | 'snow' | 'volcano' | 'mold' | 'mercury' | 'void' | 'seed' | 'rust' | 'spore' | 'algae' | 'poison' | 'dust' | 'firework' | 'bubble' | 'glitter' | 'star' | 'comet' | 'blackhole' | 'firefly' | 'worm' | 'fairy' | 'fish' | 'moth' | 'vent'
export const MATERIAL_TO_ID: Record<Material, number> = {
empty: EMPTY, sand: SAND, water: WATER, dirt: DIRT, stone: STONE, plant: PLANT,
fire: FIRE, gas: GAS, fluff: FLUFF, bug: BUG, plasma: PLASMA,
nitro: NITRO, glass: GLASS, lightning: LIGHTNING, slime: SLIME, ant: ANT, alien: ALIEN, quark: QUARK,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (y < rows - 1 && rand() < 0.013) { | ||
| const sdx = Math.floor(rand() * 3) - 1 | ||
| const snx = x + sdx | ||
| if (snx >= 0 && snx < cols && g[idx(snx, y + 1)] === EMPTY) g[idx(snx, y + 1)] = WATER |
There was a problem hiding this comment.
Cloud water spawning writes directly into g[idx(snx, y + 1)] but doesn't wake/mark the destination chunk. Since ChunkMap.updateActivity() only recomputes checksums for currently-active chunks, spawning into a sleeping chunk can leave the new WATER unrendered and unprocessed until something else wakes that chunk. Consider passing chunkMap into this handler (or using a helper like simSetCell) to wakeChunk/mark dirty for the destination cell’s chunk when spawning water (especially now that spawning can be diagonal into neighboring chunk columns).
| if (snx >= 0 && snx < cols && g[idx(snx, y + 1)] === EMPTY) g[idx(snx, y + 1)] = WATER | |
| if (snx >= 0 && snx < cols) { | |
| const d = idx(snx, y + 1) | |
| if (g[d] === EMPTY) { | |
| g[d] = WATER | |
| stampGrid[d] = tickParity | |
| } | |
| } |
No description provided.