Reference
ToolWindow
Public Kotlin SDK declarations.
Usage context
| Module | Package | SDK source |
|---|---|---|
| Kotlin/Native | nimby | kotlin/src/nimby/ToolWindow.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.ToolWindow
import nimby.ToolWindowEvent
import nimby.ToolClock
import nimby.ToolTimeChangeToolWindow
data class ToolWindow(val id: String, val title: String, val shortcut: String)Standalone tool-window declaration, accessible by shortcut while playing. Register it through ToolModBuilder.window; no selected signal is required.
ToolWindow.id
val id: StringWindow identifier unique within the mod, received in ToolWindowEvent.window. Keep it stable across versions: the shortcut preference is attached to it. Do not translate this identifier.
ToolWindow.title
val title: StringText used both as the window title and its shortcut label under the mod’s group in Options → NRF Hub. Accepts tr; a short title avoids repeating the mod name. Changing it does not change identity.
ToolWindow.shortcut
val shortcut: StringInitial shortcut in the format accepted by window(...); empty to disable. The player can change the binding in the SDK options. The declaration does not necessarily represent the current binding.
ToolWindowEvent
data class ToolWindowEvent(
val window: String, val action: String, val values: Map<String, Int>,
val sequence: Long, val worldId: String, val generation: Long,
)Event supplied to a window handler. Valid fields are sent together on click, not on each keystroke. Use the same request to publish its corresponding form.
ToolWindowEvent.window
val window: StringIdentifier of the declared window that produced this event.
ToolWindowEvent.action
val action: Stringopen when opening, then the identifier of the activated button. Button text does not define its handling.
ToolWindowEvent.values
val values: Map<String, Int>Map of validated form integers at click time, keyed by field ID. An absent field must not be invented as zero.
ToolWindowEvent.sequence
val sequence: LongForm/event sequence supplied by the SDK. Pass it through the received request; do not fabricate an event to reuse an old window.
ToolWindowEvent.worldId
val worldId: StringEvent world identity, required to match ToolContext for showWindow.
ToolWindowEvent.generation
val generation: LongEvent session generation. A different generation requires rejecting the old form and its intentions.
ToolClock
data class ToolClock(val utcSeconds: Long, val elapsedMillis: Long)Copied reading of two different times: UTC calendar and elapsed simulation time. Pause, acceleration and a date change must not be confused with the computer’s real time.
ToolClock.utcSeconds
val utcSeconds: LongGame calendar in signed seconds since 1 January 1970 UTC. Convert with dateTime; this is not the computer’s system clock.
ToolClock.elapsedMillis
val elapsedMillis: LongElapsed simulation time in milliseconds. Use this unit to reason about simulation without interpreting it as a UTC date.
ToolTimeChange
data class ToolTimeChange(val clock: ToolClock, val interventions: Long)Result of a calendar change: returned clock and recalculation-intervention count. A received response lets you display the resulting state without replaying the command.
ToolTimeChange.clock
val clock: ToolClockClock returned after the change, used to display the date actually obtained.
ToolTimeChange.interventions
val interventions: LongNumber of native interventions during train recalculation; zero for a simple calendar translation. Interventions may move trains and incur costs.