MaterialInteraction

Material interaction and state transition engine.

Constructor

new MaterialInteraction()

Methods

(static) advanceBurn(params) → {InteractionResult}

Advance burning progression. Transitions to CHARRED when duration met.

Parameters:
NameTypeDescription
paramsobject
Properties
NameTypeAttributesDefaultDescription
statestring

Current state.

materialIdstring | object

Material identifier or definition.

elapsedTicksnumber<optional>
1

Ticks to advance or total elapsed ticks.

currentBurnTicksnumber<optional>
0

Ticks already burned.

registryMaterialRegistry<optional>
Returns:
Type: 
InteractionResult

(static) applyInteraction(params) → {InteractionResult|string}

Compute next state and apply interaction rules.

Parameters:
NameTypeDescription
paramsobject
Properties
NameTypeAttributesDefaultDescription
statestring

Current state: 'dry', 'wet', 'burning', 'charred', 'extinguished'.

interactionstring | Array.<string><optional>

Single interaction or list of interactions.

interactionsArray.<string><optional>

Alternative array of interactions.

materialIdstring | object

Material identifier or definition object.

intensitynumber<optional>
1

Intensity of interaction (>= 0).

moistureThresholdnumber<optional>
1.0

Threshold that intensity must exceed to ignite wet material.

registryMaterialRegistry<optional>

Optional custom MaterialRegistry.

elapsedTicksnumber<optional>

Optional elapsed burn duration ticks.

returnStateOnlyboolean<optional>
false

If true, returns only the state string.

Returns:
Type: 
InteractionResult | string

(static) getEffectiveTraversalCost(arg1, arg2opt) → {number}

Query effective traversal cost based on material attributes and current state. Supports both getEffectiveTraversalCost(materialId, state) and getEffectiveTraversalCost({ materialId, state }).

Parameters:
NameTypeAttributesDescription
arg1string | object

materialId or options object.

arg2string<optional>

state if arg1 is materialId.

Returns:

Effective traversal cost (>= 1.0).

Type: 
number

(static) getHazardStatus(arg1, arg2opt) → {Object}

Query hazard status based on material attributes and current state. Supports both getHazardStatus(materialId, state) and getHazardStatus({ materialId, state }).

Parameters:
NameTypeAttributesDescription
arg1string | object

materialId or options object.

arg2string<optional>

state if arg1 is materialId.

Returns:
Type: 
Object

(static) isHazard(arg1, arg2opt) → {boolean}

Check if the material and state combination constitutes a hazard.

Parameters:
NameTypeAttributesDescription
arg1string | object

materialId or options object.

arg2string<optional>

state.

Returns:
Type: 
boolean

(static) query(query) → {object}

Query traversal cost and hazard status together.

Parameters:
NameTypeDescription
queryobject

Query parameters { materialId, state }.

Returns:
Type: 
object

(static) transition(params) → {string}

Helper to compute only the next state string.

Parameters:
NameTypeDescription
paramsobject

Same parameters as applyInteraction.

Returns:

The next state string.

Type: 
string