Reference
Shizen and Arashi environments
import { … } from "@johnmorrisdotca/houseki/nature";
7.0 kB minified and gzipped, with everything it imports (measured with esbuild)
Exports
| Name | Kind | What it is |
|---|---|---|
applyEarthquake | function | Commit one bounded environmental resolution; matching, gravity and score remain the host game's job. |
applyLightning | function | Commit one lightning strike. |
applyMagneticPulse | function | Apply one attraction pulse. |
applyPowerDrop | function | Commit a previewed landing as one immutable operation. |
AttractionPairPreview | type | A pure attraction decision including the paired ids, axis, gap, midpoint and moves. |
createNatureState | function | Create a validated seeded native environment grid with fixed masks and mechanic switches. |
EarthquakeKind | type | The native fault, jumble or combined earthquake mode. |
EarthquakeOptions | type | The earthquake mode and optional enabled flag. |
EnvironmentEvent | type | A committed earthquake or lightning event with its native preview fields. |
EnvironmentPreview | type | A native earthquake or lightning preview before it is committed. |
EnvironmentSchedule | type | A periodic, one-turn or authored list of environment trigger turns. |
EnvironmentTransition | type | The committed environment state, event list and pure preview. |
FaultPreview | type | A pure earthquake fault path, removed ids and resulting occupants/passability mask. |
HorizontalDirection | type | The native left or right direction used for rebound decisions. |
isEnvironmentTurnScheduled | function | Pure one-based schedule lookup: frequent is every second turn; rare is every eighth turn. |
JumblePreview | type | A pure eligible-patch shuffle and resulting occupants; reason explains when no patch exists. |
LightningOptions | type | Lightning enablement and explicit columns or a bounded column count. |
LightningPreview | type | A pure selected-column removal and resulting occupants/random state. |
MagneticPreview | type | A pure magnetic-pulse result; no input state or random source is consumed. |
MarkingOptions | type | The probability and optional count/anchor bounds used to mark magnetic stones. |
markMagneticStones | function | Deterministically assign magnetic markings to settled stones without changing their IDs or colours. |
NatureEntity | type | Stable board occupant. |
NatureErrorCode | type | Stable native validation codes for grid, cell, marking and power-drop failures. |
NatureEvent | type | An emitted native magnetic marking, attraction or power-drop event. |
NatureMove | type | One native stable-id move between two board coordinates. |
NatureOptions | type | The native grid dimensions, passability mask, occupants, seed and magnetic/rebound settings. |
NatureOptionsError | class | A typed native grid, cell, marking or power-drop validation error. |
NaturePieceCell | type | A falling native stone with its cell coordinates and stable id. |
NatureRules | type | The fixed native magnetic and rebound rule switches. |
NatureState | type | The immutable native environment state with stable ids, seeded random state and placement count. |
NatureTransition | type | The native environment result, emitted events and optional pure preview. |
PowerDropPreview | type | The pure normal landing, rebound attempts and final lock cells with resulting random state. |
PowerDropRequest | type | The native piece cells, pivot id and host-selected power/rebound options. |
previewEarthquake | function | Preview an earthquake, with Combined always fracturing before its one jumble attempt. |
previewFault | function | Preview a bounded top-to-bottom fracture. |
previewJumble | function | Preview one seeded, nontrivial stone permutation inside a fully active connected rectangle no larger than 3×3. |
previewLightning | function | Preview seeded or explicitly selected columns; a mask gap or obstacle blocks the strike below it. |
previewMagneticPulse | function | Preview one bounded deterministic attraction pulse without mutating the state. |
previewPowerDrop | function | Preview a single normal landing and, for a power drop, at most one validated one-cell rebound. |
QuarterTurn | type | A counterclockwise, unchanged or clockwise quarter-turn chosen by the host. |
ReboundAttemptPreview | type | One tested rebound direction and quarter-turn with its collision-validity result. |
ReboundDirectionMode | type | Whether rebound prefers recent input/alternation or the seeded random source. |