Reference
AutomaticDriving
Build generic instructions with speeds chosen by your mod.
Usage context
| Module | Package | SDK source |
|---|---|---|
| Kotlin/Native | nimby | kotlin/src/nimby/AutomaticDriving.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.AutomaticDrivingAutomaticDriving
object AutomaticDrivingBuilds driving rules in m/s without reading the game. Return a rule from driving. The mod chooses every speed and permission; colours do not determine them.
AutomaticDriving.clear
fun clear(): DrivingRuleReleases restrictions whose policy ends on Clear. Does not itself declare a track physically clear.
AutomaticDriving.stop
fun stop(): DrivingRuleRequires a stop at the current signal, with no permission to pass it.
AutomaticDriving.announceStop
fun announceStop(signalsAhead: Int, passageSpeedMps: Double,
passableHere: Boolean, followTargetSpeed: Boolean = false,
cancelAtNextClear: Boolean = false): DrivingRuleRemembers a stop one or two signals ahead when passing this signal. Target permission replaces that stop with passageSpeedMps until the train head passes it. passableHere concerns the current signal. followTargetSpeed accepts the target’s numeric speed; cancelAtNextClear requires that option and a target two signals ahead. Speed must be finite and nonnegative.
AutomaticDriving.limitAtSignal
fun limitAtSignal(speedMps: Double, passableHere: Boolean): DrivingRuleA local speed ceiling at this signal, in m/s, with no retained restriction after passage. Speed must be finite and nonnegative; passableHere=true requires a strictly positive speed.
AutomaticDriving.limitUntilClearThenRear
fun limitUntilClearThenRear(speedMps: Double, signalsAhead: Int, passableHere: Boolean): DrivingRuleApplies a strictly positive speed in m/s at this signal or one/two signals ahead. The restriction remains until the rear clears a Clear signal actually passed. passableHere permits passage of the current signal without removing other restrictions.
AutomaticDriving.restrictedUntilNextSignal
fun restrictedUntilNextSignal(entrySpeedMps: Double, maximumSpeedMps: Double, stopFirst: Boolean): DrivingRulePermits restricted movement until the train head reaches the next signal, braking for physically clear space. maximumSpeedMps must be positive; entrySpeedMps lies between zero and that maximum. stopFirst requires entrySpeedMps=0 and a prior stop. This permission can replace the followed track’s occupancy/reservation gate; physical obstacles, crossing conflicts and route checks still block movement.