instrument

Shared surface of every instrument: one quantity, in fixed units, sampled once a second.

Readings are cached on the block, so these calls are cheap and safe to poll. Every reading is taken at the instrument's world position: on an airship it is the air outside the airship.

Units by peripheral type: thermometer degrees Celsius, hygrometer relative humidity 0..1, barometer hectopascals, rain_gauge millimetres per hour, almanac fraction of the year 0..1 (or of the lunar cycle without seasons).

getValue()Get the latest reading.
getUnit()Get the unit readings are in.
read()Get the latest reading with its context.
getValue()Source

Get the latest reading.

Returns

  1. number The measured value, in this instrument's unit.
getUnit()Source

Get the unit readings are in.

Returns

  1. string "C", "rh", "hPa", "mm/h", or for the almanac "year" (fraction of the season year) or "moon" (fraction of the lunar cycle, where there is no season calendar).
read()Source

Get the latest reading with its context.

Returns

  1. { [string] = any } A table with value, unit, time (game time of the sample, in ticks) and source (where the value came from, e.g. "thermoo", "sable", "serene_seasons" or "vanilla").