NRF SDK 0.9

Reference

NumberSetting

Persistent bounded integer settings in signal panels.

Usage context

ModulePackageSDK source
Kotlin/Nativenimbykotlin/src/nimby/NumberSetting.kt

Public API for SDK 0.9.0-alpha.2. Each entry provides the Kotlin signature and its contract: what the value means, conditions of use and effects to understand. Choose imports from the module shown above.

Imports on this page
import nimby.NumberSetting

NumberSetting

nimby · class
class NumberSetting(val name: String, val label: String, val maximum: Int,
                    val defaultValue: Int = 0, val visibleWhen: String = "")

Persistent integer signal setting from zero through maximum. Declare number(option) in the model; read it with read and prepare copies with withValue.

NumberSetting.name

nimby · val
val name: String

Stable key of 1 to 96 characters, starting with an ASCII letter, followed by letters, digits, dots, hyphens or underscores. Do not translate.

NumberSetting.label

nimby · val
val label: String

Field label in the signal panel; accepts tr. Does not define the value’s domain meaning.

NumberSetting.maximum

nimby · val
val maximum: Int

Inclusive upper bound, from 1 to 65535. The lower value bound is always zero.

NumberSetting.defaultValue

nimby · val
val defaultValue: Int = 0

Default value between zero and maximum; defaults to zero. Missing values use this default when read.

NumberSetting.visibleWhen

nimby · val
val visibleWhen: String = ""

Name of a checkbox in the same model controlling visibility; empty for always visible. Hiding the field does not erase its value.

NumberSetting.read

nimby · fun
fun read(settings: Map<String, Boolean>): Int

Reads the integer from a settings map, fills missing data from its default and clamps the result between zero and maximum. No game access occurs.

NumberSetting.withValue

nimby · fun
fun withValue(settings: Map<String, Boolean>, value: Int): Map<String, Boolean>

Returns a new map with the requested integer while preserving other settings. Rejects values outside 0..maximum; this calculation saves nothing into the game.