fires.getById
Returns one burning fire by its ID, or undefined once it is out.
Renamed in 0.28 from fires.get; see renamed names.
Signature
Section titled “Signature”fires.getById(id: string): SharedFire | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id |
string |
The fire’s ID, a decimal string from fires.listAll or an event. |
Returns
Section titled “Returns”The SharedFire, or undefined.
Example
Section titled “Example”import { fires, server } from "nativemp";
server.on("sharedFireUpdated", ({ fire }) => { const current = fires.getById(fire.id); if (current) server.log(`${current.id} now has strength ${current.strength}`);});Related
Section titled “Related”SharedFire: the fire’s fieldsfires.listAll: every firesharedFireUpdated: a fire’s state changedsharedFireStopped: a fire went out