withDependency

fun <K : Setting<*>> K.withDependency(dependency: () -> Boolean): K

Set a dependency which has to be fulfilled for this Setting to show up in the GUI.


The definition of this function as an extension function within a companion object is really scuffed and overly complicated. But this allows for a streamlined usage: private val setting = SomeSetting("Name", ... parameters) .withDependency { this.mode.index == 0 } Almost like with a lambda function in the constructor (which would not be a good choice here).