Chemistry · class
ChemistryWorld
Explained in Chemistry.
class ChemistryWorldimport { ChemistryWorld } from '@driftengine/chemistry';Constructor
new
constructor( /** The parcels this world steps. Readable, because `fingerprintChemistry` hashes them. */ parcels: ParcelStore, /** The air, or `null` for a world with none. Readable for the same reason. */ field?: AtmosphereField | null, options?: ChemistryWorldOptions)| Parameter | Type | Description |
|---|---|---|
/** The parcels this world steps. Readable | | |
because `fingerprintChemistry` hashes them. */ parcels: ParcelStore | | |
/** The air | | |
or `null` for a world with none. Readable for the same reason. */ field?: AtmosphereField | null | | |
options? | ChemistryWorldOptions |
Properties
| Name | Type | Description |
|---|---|---|
parcelsreadonly | ParcelStore | The parcels this world steps. Readable, because fingerprintChemistry hashes them. |
fieldreadonly | AtmosphereField | null | The air, or null for a world with none. Readable for the same reason. |
sourcesreadonly | RadiativeSources | Refilled by the caller each tick: what is radiating. |
contactsreadonly | ContactSet | Refilled by the caller each tick: what is touching what. |
eventsreadonly | ChemistryEvents | Drained by the caller each tick: what happened. Cleared at the top of every simulate. |
occluded | OcclusionTest | null | Whether anything solid stands between two points.MoreAbsent, every source is visible — the cheap default, and wrong indoors. A consumer supplies a
raycast; |
Methods
simulate
simulate(dt: number, windX?: number, windZ?: number): voidOne fixed step, in the order §13 gives.
| Parameter | Type | Description |
|---|---|---|
dt | number | |
windX? | number | |
windZ? | number |
More
Sleeping and the tier cadence are both here rather than inside the terms they skip, because both are decisions about whether a parcel is stepped at all and a term that decided for itself would be four places deciding the same thing four ways.
ignitionProgressOf
ignitionProgressOf(parcel: number): numberHow close a parcel is to catching, 0 to 1. A readout; nothing branches on it.
| Parameter | Type | Description |
|---|---|---|
parcel | number |
elementTotals
elementTotals(out: Float64Array): voidMoles of each element in the parcels and the air together. Writes into out.
| Parameter | Type | Description |
|---|---|---|
out | Float64Array |