Reference
NumberSetting
Persistent bounded integer settings in signal panels.
Usage context
| Module | Package | SDK source |
|---|---|---|
| Kotlin/Native | nimby | kotlin/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.
import nimby.NumberSettingNumberSetting
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
val name: StringStable key of 1 to 96 characters, starting with an ASCII letter, followed by letters, digits, dots, hyphens or underscores. Do not translate.
NumberSetting.label
val label: StringField label in the signal panel; accepts tr. Does not define the value’s domain meaning.
NumberSetting.maximum
val maximum: IntInclusive upper bound, from 1 to 65535. The lower value bound is always zero.
NumberSetting.defaultValue
val defaultValue: Int = 0Default value between zero and maximum; defaults to zero. Missing values use this default when read.
NumberSetting.visibleWhen
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
fun read(settings: Map<String, Boolean>): IntReads 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
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.