package ru.dbotthepony.mc.otm.config

import ru.dbotthepony.kommons.util.getValue
import ru.dbotthepony.kommons.util.setValue
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.math.defineDecimal

object CablesConfig : AbstractConfig("cables") {
	enum class E(throughput: Decimal) {
		CRUDE(Decimal(1024)),
		REGULAR(Decimal(8192)),
		ADVANCED(Decimal(40960)),
		SUPERCONDUCTOR(Decimal.POSITIVE_INFINITY);

		init {
			builder.push(name)
		}

		var throughput by builder
			.defineDecimal("THROUGHPUT", throughput, Decimal.ZERO)

		init {
			builder.pop()
		}
	}

	init {
		E.SUPERCONDUCTOR
	}

	val SEARCHES_PER_TICK: Int by builder
		.comment("How many paths are allowed to be searched for during single tick *per* cable network")
		.comment("Too low value will make huge cable networks woozy when their cabling changes (e.g. cable added or removed, or valve switched)")
		.comment("Too high value will create lag spikes depending on complexity of cable network at hand when cabling changes")
		.defineInRange("SEARCHER_PER_TICK", 40, 1)
}
