mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 00:26:07 +09:00
+ simply changing the single variable (ingame.world) will update all the renderer's behaviour + somehow my git changelogs are exploding
46 lines
1.4 KiB
Kotlin
46 lines
1.4 KiB
Kotlin
package net.torvald.terrarum.console
|
|
|
|
import com.badlogic.gdx.graphics.Color
|
|
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
|
import net.torvald.terrarum.Terrarum
|
|
import net.torvald.terrarum.modulebasegame.Ingame
|
|
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
|
|
|
/**
|
|
* Created by minjaesong on 2016-02-17.
|
|
*/
|
|
internal object SetGlobalLightOverride : ConsoleCommand {
|
|
|
|
override fun execute(args: Array<String>) {
|
|
if (args.size == 5) {
|
|
try {
|
|
val r = args[1].toFloat()
|
|
val g = args[2].toFloat()
|
|
val b = args[3].toFloat()
|
|
val a = args[4].toFloat()
|
|
val GL = Color(r, g, b, a)
|
|
|
|
WeatherMixer.globalLightOverridden = true
|
|
(Terrarum.ingame!!.world).globalLight = GL
|
|
}
|
|
catch (e: NumberFormatException) {
|
|
Echo("Wrong number input.")
|
|
}
|
|
catch (e1: IllegalArgumentException) {
|
|
Echo("Range: 0-" + LightmapRenderer.CHANNEL_MAX + " per channel")
|
|
}
|
|
|
|
}
|
|
else if (args.size == 2 && args[1].trim().toLowerCase() == "none") {
|
|
WeatherMixer.globalLightOverridden = false
|
|
}
|
|
else {
|
|
printUsage()
|
|
}
|
|
}
|
|
|
|
override fun printUsage() {
|
|
Echo("Usage: setgl [r g b a|“none”]")
|
|
}
|
|
}
|