diff --git a/assets/mods/basegame/blocks/22.tga b/assets/mods/basegame/blocks/22.tga index 2e5faad6a..7e0b4e835 100644 --- a/assets/mods/basegame/blocks/22.tga +++ b/assets/mods/basegame/blocks/22.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b6a8d3d899c577afd72b53c7432bbf8b3f63d45a4bcec5c6fd350d49ec19c31f +oid sha256:dd9500638ed8df143471d450f5a08f366bcb6b07081a89700403012190f5bc64 size 56594 diff --git a/assets/mods/basegame/blocks/23.tga b/assets/mods/basegame/blocks/23.tga new file mode 100644 index 000000000..cb8fd84d6 --- /dev/null +++ b/assets/mods/basegame/blocks/23.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2554f1fe7f2f15e18face4b7c2212b1ebdf1a0ab0449ef5f7de1d0aeaf5bc325 +size 56594 diff --git a/assets/mods/basegame/blocks/24.tga b/assets/mods/basegame/blocks/24.tga new file mode 100644 index 000000000..da4732168 --- /dev/null +++ b/assets/mods/basegame/blocks/24.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb94b23a19ccb7de64be15507474912371b77163993c6e61abe233cf2c90edee +size 56594 diff --git a/assets/mods/basegame/blocks/25.tga b/assets/mods/basegame/blocks/25.tga new file mode 100644 index 000000000..8bdceadf6 --- /dev/null +++ b/assets/mods/basegame/blocks/25.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:885235045a35a9b353cc0dd91e99881e6d3d2ccbb60124be258183096b1b4f63 +size 56594 diff --git a/assets/mods/basegame/blocks/36.tga b/assets/mods/basegame/blocks/36.tga new file mode 100644 index 000000000..2e5faad6a --- /dev/null +++ b/assets/mods/basegame/blocks/36.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6a8d3d899c577afd72b53c7432bbf8b3f63d45a4bcec5c6fd350d49ec19c31f +size 56594 diff --git a/assets/mods/basegame/blocks/blocks.csv b/assets/mods/basegame/blocks/blocks.csv index f26e5f032..4fd19a100 100644 --- a/assets/mods/basegame/blocks/blocks.csv +++ b/assets/mods/basegame/blocks/blocks.csv @@ -9,13 +9,17 @@ "19";"19";"19";"BLOCK_STONE_BRICKS";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"STONE" "20";"20";"20";"BLOCK_STONE_DEEP";"0.1252";"0.1252";"0.1252";"0.1252";"80";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"ROCK,NATURA,OREBEARING,DEEPROCK,BRICKROCK" "21";"21";"21";"BLOCK_STONE_MARBLE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.1";"ROCK,NATURAL,DEEPROCK" -"22";"22";"22";"BLOCK_BRICKS";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"BRCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.1";"ROCK,NATURAL,DEEPROCK" +"22";"22";"22";"BLOCK_STONE_ORTHOCLASE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"ROCK,NATURAL,OREBEARING,SHALLOWROCK,BRICKROCK" +"23";"23";"23";"BLOCK_STONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"ROCK,NATURAL,OREBEARING,SHALLOWROCK,BRICKROCK" +"24";"24";"24";"BLOCK_STONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"ROCK,NATURAL,OREBEARING,SHALLOWROCK,BRICKROCK" +"25";"25";"25";"BLOCK_STONE_BASALT";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"ROCK,NATURAL,OREBEARING,SHALLOWROCK,BRICKROCK" # dirts "32";"32";"32";"BLOCK_DIRT";"0.1252";"0.1252";"0.1252";"0.1252";"12";"1400";"DIRT";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"DIRT,NATURAL,CULTIVABLE" "33";"32";"32";"BLOCK_GRASS";"0.1252";"0.1252";"0.1252";"0.1252";"12";"1400";"GRSS";"1";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"GRASS,NATURAL,CULTIVABLE" "34";"34";"34";"BLOCK_GRASSWALL";"0.1252";"0.1252";"0.1252";"0.1252";"12";"1400";"GRSS";"1";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"GRASS,NATURAL" "35";"item@basegame:25";"item@basegame:25";"BLOCK_CLAY";"0.1252";"0.1252";"0.1252";"0.1252";"12";"1700";"DIRT";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"DIRT,NATURAL" +"36";"36";"36";"BLOCK_BRICKS";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"BRCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.1";"ROCK,NATURAL,DEEPROCK" #"35";"35";"35";"BLOCK_FOLIAGE_GREEN";"0.1252";"0.1252";"0.1252";"0.1252";"12";"1400";"GRSS";"1";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"GRASS,NATURAL" #"36";"36";"36";"BLOCK_FOLIAGE_LIME";"0.1252";"0.1252";"0.1252";"0.1252";"12";"1400";"GRSS";"1";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"GRASS,NATURAL" #"37";"37";"37";"BLOCK_FOLIAGE_GOLD";"0.1252";"0.1252";"0.1252";"0.1252";"12";"1400";"GRSS";"1";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"0.0";"GRASS,NATURAL" diff --git a/assets/mods/basegame/crafting/masonry.json b/assets/mods/basegame/crafting/masonry.json index 0cfe22fe7..c7413b7d2 100644 --- a/assets/mods/basegame/crafting/masonry.json +++ b/assets/mods/basegame/crafting/masonry.json @@ -14,8 +14,8 @@ [1, 3, "$BRICKROCK"] ] }, - /* brocks */ - "basegame:22": { + /* bricks */ + "basegame:36": { "workbench": "", "ingredients": [ [1, 2, "item@basegame:56"] diff --git a/src/com/sudoplay/joise/module/TerrarumModuleCombiner.kt b/src/com/sudoplay/joise/module/TerrarumModuleCombiner.kt new file mode 100644 index 000000000..5cd6cd2a5 --- /dev/null +++ b/src/com/sudoplay/joise/module/TerrarumModuleCombiner.kt @@ -0,0 +1,439 @@ +package com.sudoplay.joise.module + +import com.sudoplay.joise.ModuleInstanceMap +import com.sudoplay.joise.ModuleMap +import com.sudoplay.joise.ModulePropertyMap +import java.util.* + +/** + * Created by minjaesong on 2024-09-22. + */ +class TerrarumModuleCombiner : Module() { + + enum class CombinerType { + ADD, MULT, MAX, MIN, AVG, VECTORISE + } + + protected var sources: Array = arrayOfNulls(MAX_SOURCES) + protected var type: CombinerType? = null + + fun ModuleCombiner(type: CombinerType?) { + this.type = type + } + + fun ModuleCombiner() { + // serialization + } + + fun setSource(index: Int, source: Module?) { + sources[index] = ScalarParameter(source) + } + + fun setSource(index: Int, source: Double) { + sources[index] = ScalarParameter(source) + } + + fun clearAllSources() { + for (i in 0 until MAX_SOURCES) { + sources[i] = null + } + } + + /** + * Noise values from empty indices will be substituted with NaN + */ + fun getVectorise(x: Double, y: Double, z: Double): List { + return when (type) { + CombinerType.VECTORISE -> vectorGet(x, y, z) + else -> throw UnsupportedOperationException("Use get") + } + } + + fun vectorGet(x: Double, y: Double, z: Double): List { + return sources.map { it?.get(x, y, z) ?: Double.NaN } + } + + override fun get(x: Double, y: Double): Double { + return when (type) { + CombinerType.ADD -> addGet(x, y) + CombinerType.AVG -> avgGet(x, y) + CombinerType.MAX -> maxGet(x, y) + CombinerType.MIN -> minGet(x, y) + CombinerType.MULT -> multGet(x, y) + CombinerType.VECTORISE -> throw UnsupportedOperationException("Use getVector") + else -> 0.0 + } + } + + override fun get(x: Double, y: Double, z: Double): Double { + return when (type) { + CombinerType.ADD -> addGet(x, y, z) + CombinerType.AVG -> avgGet(x, y, z) + CombinerType.MAX -> maxGet(x, y, z) + CombinerType.MIN -> minGet(x, y, z) + CombinerType.MULT -> multGet(x, y, z) + CombinerType.VECTORISE -> throw UnsupportedOperationException("Use getVector") + else -> 0.0 + } + } + + override fun get(x: Double, y: Double, z: Double, w: Double): Double { + return when (type) { + CombinerType.ADD -> addGet(x, y, z, w) + CombinerType.AVG -> avgGet(x, y, z, w) + CombinerType.MAX -> maxGet(x, y, z, w) + CombinerType.MIN -> minGet(x, y, z, w) + CombinerType.MULT -> multGet(x, y, z, w) + CombinerType.VECTORISE -> throw UnsupportedOperationException("Use getVector") + else -> 0.0 + } + } + + override fun get(x: Double, y: Double, z: Double, w: Double, u: Double, v: Double): Double { + return when (type) { + CombinerType.ADD -> addGet(x, y, z, w, u, v) + CombinerType.AVG -> avgGet(x, y, z, w, u, v) + CombinerType.MAX -> maxGet(x, y, z, w, u, v) + CombinerType.MIN -> minGet(x, y, z, w, u, v) + CombinerType.MULT -> multGet(x, y, z, w, u, v) + CombinerType.VECTORISE -> throw UnsupportedOperationException("Use getVector") + else -> 0.0 + } + } + + + // ========================================================================== + // = ADD + // ========================================================================== + protected fun addGet(x: Double, y: Double): Double { + var value = 0.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) value += sources[i]!![x, y] + } + return value + } + + protected fun addGet(x: Double, y: Double, z: Double): Double { + var value = 0.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) value += sources[i]!![x, y, z] + } + return value + } + + protected fun addGet(x: Double, y: Double, z: Double, w: Double): Double { + var value = 0.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) value += sources[i]!![x, y, z, w] + } + return value + } + + protected fun addGet( + x: Double, y: Double, z: Double, w: Double, u: Double, + v: Double + ): Double { + var value = 0.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) value += sources[i]!![x, y, z, w, u, v] + } + return value + } + + + // ========================================================================== + // = AVG + // ========================================================================== + protected fun avgGet(x: Double, y: Double): Double { + var count = 0 + var value = 0.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) { + value += sources[i]!![x, y] + count++ + } + } + if (count == 0) return 0.0 + return value / count.toDouble() + } + + protected fun avgGet(x: Double, y: Double, z: Double): Double { + var count = 0 + var value = 0.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) { + value += sources[i]!![x, y, z] + count++ + } + } + if (count == 0) return 0.0 + return value / count.toDouble() + } + + protected fun avgGet(x: Double, y: Double, z: Double, w: Double): Double { + var count = 0 + var value = 0.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) { + value += sources[i]!![x, y, z, w] + count++ + } + } + if (count == 0) return 0.0 + return value / count.toDouble() + } + + protected fun avgGet( + x: Double, y: Double, z: Double, w: Double, u: Double, + v: Double + ): Double { + var count = 0 + var value = 0.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) { + value += sources[i]!![x, y, z, w, u, v] + count++ + } + } + if (count == 0) return 0.0 + return value / count.toDouble() + } + + + // ========================================================================== + // = MAX + // ========================================================================== + protected fun maxGet(x: Double, y: Double): Double { + var mx: Double + var c = 0 + while (c < MAX_SOURCES && sources[c] == null) { + c++ + } + if (c == MAX_SOURCES) return 0.0 + mx = sources[c]!![x, y] + + for (d in c until MAX_SOURCES) { + if (sources[d] != null) { + val `val` = sources[d]!![x, y] + if (`val` > mx) mx = `val` + } + } + + return mx + } + + protected fun maxGet(x: Double, y: Double, z: Double): Double { + var mx: Double + var c = 0 + while (c < MAX_SOURCES && sources[c] == null) { + c++ + } + if (c == MAX_SOURCES) return 0.0 + mx = sources[c]!![x, y, z] + + for (d in c until MAX_SOURCES) { + if (sources[d] != null) { + val `val` = sources[d]!![x, y, z] + if (`val` > mx) mx = `val` + } + } + + return mx + } + + protected fun maxGet(x: Double, y: Double, z: Double, w: Double): Double { + var mx: Double + var c = 0 + while (c < MAX_SOURCES && sources[c] == null) { + c++ + } + if (c == MAX_SOURCES) return 0.0 + mx = sources[c]!![x, y, z, w] + + for (d in c until MAX_SOURCES) { + if (sources[d] != null) { + val `val` = sources[d]!![x, y, z, w] + if (`val` > mx) mx = `val` + } + } + + return mx + } + + protected fun maxGet( + x: Double, y: Double, z: Double, w: Double, u: Double, + v: Double + ): Double { + var mx: Double + var c = 0 + while (c < MAX_SOURCES && sources[c] == null) { + c++ + } + if (c == MAX_SOURCES) return 0.0 + mx = sources[c]!![x, y, z, w, u, v] + + for (d in c until MAX_SOURCES) { + if (sources[d] != null) { + val `val` = sources[d]!![x, y, z, w, u, v] + if (`val` > mx) mx = `val` + } + } + + return mx + } + + + // ========================================================================== + // = MIN + // ========================================================================== + protected fun minGet(x: Double, y: Double): Double { + var mn: Double + var c = 0 + while (c < MAX_SOURCES && sources[c] == null) { + c++ + } + if (c == MAX_SOURCES) return 0.0 + mn = sources[c]!![x, y] + + for (d in c until MAX_SOURCES) { + if (sources[d] != null) { + val `val` = sources[d]!![x, y] + if (`val` < mn) mn = `val` + } + } + + return mn + } + + protected fun minGet(x: Double, y: Double, z: Double): Double { + var mn: Double + var c = 0 + while (c < MAX_SOURCES && sources[c] == null) { + c++ + } + if (c == MAX_SOURCES) return 0.0 + mn = sources[c]!![x, y, z] + + for (d in c until MAX_SOURCES) { + if (sources[d] != null) { + val `val` = sources[d]!![x, y, z] + if (`val` < mn) mn = `val` + } + } + + return mn + } + + protected fun minGet(x: Double, y: Double, z: Double, w: Double): Double { + var mn: Double + var c = 0 + while (c < MAX_SOURCES && sources[c] == null) { + c++ + } + if (c == MAX_SOURCES) return 0.0 + mn = sources[c]!![x, y, z, w] + + for (d in c until MAX_SOURCES) { + if (sources[d] != null) { + val `val` = sources[d]!![x, y, z, w] + if (`val` < mn) mn = `val` + } + } + + return mn + } + + protected fun minGet( + x: Double, y: Double, z: Double, w: Double, u: Double, + v: Double + ): Double { + var mn: Double + var c = 0 + while (c < MAX_SOURCES && sources[c] == null) { + c++ + } + if (c == MAX_SOURCES) return 0.0 + mn = sources[c]!![x, y, z, w, u, v] + + for (d in c until MAX_SOURCES) { + if (sources[d] != null) { + val `val` = sources[d]!![x, y, z, w, u, v] + if (`val` < mn) mn = `val` + } + } + + return mn + } + + + // ========================================================================== + // = MULT + // ========================================================================== + protected fun multGet(x: Double, y: Double): Double { + var value = 1.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) value *= sources[i]!![x, y] + } + return value + } + + protected fun multGet(x: Double, y: Double, z: Double): Double { + var value = 1.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) value *= sources[i]!![x, y, z] + } + return value + } + + protected fun multGet(x: Double, y: Double, z: Double, w: Double): Double { + var value = 1.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) value *= sources[i]!![x, y, z, w] + } + return value + } + + protected fun multGet( + x: Double, y: Double, z: Double, w: Double, u: Double, + v: Double + ): Double { + var value = 1.0 + for (i in 0 until MAX_SOURCES) { + if (sources[i] != null) value *= sources[i]!![x, y, z, w, u, v] + } + return value + } + + override fun _writeToMap(map: ModuleMap) { + val props = ModulePropertyMap(this) + + writeEnum("type", type, props) + + for (i in 0 until MAX_SOURCES) { + writeScalar("source$i", sources[i], props, map) + } + + map[id] = props + } + + override fun buildFromPropertyMap( + props: ModulePropertyMap, + map: ModuleInstanceMap + ): Module { + readEnum("type", "setType", CombinerType::class.java, props) + + var name: String + var o: Any? + for (i in 0 until MAX_SOURCES) { + o = props["source$i"] + if (o != null) { + name = o.toString() + setSource(i, map[name]) + } + } + + return this + } + + +} \ No newline at end of file diff --git a/src/net/torvald/terrarum/blockproperties/Block.kt b/src/net/torvald/terrarum/blockproperties/Block.kt index 1913e77a7..1c97f9993 100644 --- a/src/net/torvald/terrarum/blockproperties/Block.kt +++ b/src/net/torvald/terrarum/blockproperties/Block.kt @@ -12,8 +12,12 @@ object Block { const val STONE_QUARRIED = "basegame:17" const val STONE_TILE_WHITE = "basegame:18" const val STONE_BRICKS = "basegame:19" - const val STONE_SLATE = "basegame:20" + const val STONE_GNEISS = "basegame:20" const val STONE_MARBLE = "basegame:21" + const val STONE_ORTHOCLASE = "basegame:22" + const val STONE_PLAGIOCLASE = "basegame:23" + const val STONE_MICROCLINE = "basegame:24" + const val STONE_BASALT = "basegame:25" const val DIRT = "basegame:32" const val GRASS = "basegame:33" diff --git a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Terragen.kt b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Terragen.kt index bb889edce..71e9668ce 100644 --- a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Terragen.kt +++ b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Terragen.kt @@ -5,6 +5,7 @@ import com.sudoplay.joise.module.* import net.torvald.random.HQRNG import net.torvald.terrarum.LoadScreenBase import net.torvald.terrarum.blockproperties.Block +import net.torvald.terrarum.gameitems.ItemID import net.torvald.terrarum.gameworld.GameWorld import net.torvald.terrarum.modulebasegame.worldgenerator.Worldgen.getClampedHeight import net.torvald.terrarum.realestate.LandUtil.CHUNK_H @@ -34,7 +35,7 @@ class Terragen(world: GameWorld, isFinal: Boolean, val groundScalingCached: Modu private val groundDepthBlock = listOf( - Block.AIR, Block.DIRT, Block.STONE, Block.STONE_SLATE + Block.AIR, Block.DIRT, Block.STONE, Block.STONE_GNEISS ) private fun Double.tiered(tiers: List): Int { @@ -229,7 +230,10 @@ class Terragen(world: GameWorld, isFinal: Boolean, val groundScalingCached: Modu } interface TerragenParams { + val version: Long + val terragenTiers: List + val terragenTiles: List val featureSize: Double val lowlandScaleOffset: Double // linearly alters the height val highlandScaleOffset: Double // linearly alters the height @@ -245,10 +249,15 @@ interface TerragenParams { val caveBlockageSelectThre: Double // adjust cave closing-up strength. Lower = more closing val rockBandCutoffFreq: Double - val lavaShapeFreg: Double } + val lavaShapeFreg: Double + +} data class TerragenParamsAlpha1( - override val terragenTiers: List = listOf(.0, .5, 1.0, 2.5, 11.0 * 9999), + override val version: Long = 0L, + + override val terragenTiers: List = listOf(.0, .5, 1.0, 2.5), + override val terragenTiles: List = listOf(Block.AIR, Block.DIRT, Block.STONE, Block.STONE_GNEISS), override val featureSize: Double = 333.0, override val lowlandScaleOffset: Double = -0.65, // linearly alters the height @@ -268,10 +277,36 @@ data class TerragenParamsAlpha1( override val rockBandCutoffFreq: Double = 4.0, override val lavaShapeFreg: Double = 0.03, + ) : TerragenParams data class TerragenParamsAlpha2( - override val terragenTiers: List = listOf(.0, .5, 1.5, 4.2, 11.0 * 9999), + override val version: Long = 0x0000_000004_000004, + +// override val terragenTiers: List = listOf(.0, .5, 1.5, 4.2), + override val terragenTiers: List = listOf(.0, .5, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 6.25, 6.50, 6.75, 7.0, 8.0, 9.0, 10.0, 11.0), + override val terragenTiles: List = listOf(Block.AIR, Block.DIRT, + Block.STONE, // 1.0 + Block.SANDSTONE, // 1.1 + Block.STONE_MICROCLINE, // 1.2 + Block.STONE_ORTHOCLASE, // 1.3 + Block.STONE_MARBLE, // 1.4 + Block.STONE, // 1.5 + Block.STONE_MICROCLINE, // 2.0 + Block.STONE_PLAGIOCLASE, // 3.0 + Block.STONE, // 4.0 + Block.STONE_ORTHOCLASE, // 5.0 + Block.STONE_MICROCLINE, // 6.0 + + Block.STONE_MARBLE, // 6.25 + Block.STONE, // 6.50 + Block.STONE_MARBLE, // 6.75 + Block.STONE_PLAGIOCLASE, // 7.0 + Block.STONE, // 8.0 + Block.STONE_BASALT, // 9.0 + Block.STONE, // 10.0 + Block.STONE_GNEISS, // 11.0 + ), override val featureSize: Double = 333.0, override val lowlandScaleOffset: Double = -0.65, // linearly alters the height diff --git a/src/net/torvald/terrarum/tests/WorldgenNoiseSandbox.kt b/src/net/torvald/terrarum/tests/WorldgenNoiseSandbox.kt index ffad184d4..824108dcb 100644 --- a/src/net/torvald/terrarum/tests/WorldgenNoiseSandbox.kt +++ b/src/net/torvald/terrarum/tests/WorldgenNoiseSandbox.kt @@ -22,6 +22,7 @@ import net.torvald.random.HQRNG import net.torvald.terrarum.FlippingSpriteBatch import net.torvald.terrarum.blockproperties.Block import net.torvald.terrarum.concurrent.ThreadExecutor +import net.torvald.terrarum.gameitems.ItemID import net.torvald.terrarum.inUse import net.torvald.terrarum.modulebasegame.worldgenerator.BiomegenParams import net.torvald.terrarum.modulebasegame.worldgenerator.TerragenParams @@ -43,6 +44,8 @@ const val NOISEBOX_WIDTH = 90 * 18 const val NOISEBOX_HEIGHT = 90 * 26 const val TWO_PI = Math.PI * 2 +//const val WORLDGEN_YOFF = 0 +//const val WORLDGEN_YOFF = 1500 const val WORLDGEN_YOFF = 5400 - NOISEBOX_HEIGHT /** @@ -398,12 +401,15 @@ internal class TerragenTest(val params: TerragenParams) : NoiseMaker { Color(0.97f, 0.6f, 0.56f, 1f) ) - private val groundDepthBlockWall = listOf( + /*private val groundDepthBlockWall = listOf( Block.AIR, Block.DIRT, Block.STONE, Block.STONE_SLATE, Block.STONE_SLATE ) private val groundDepthBlockTERR = ArrayList(groundDepthBlockWall).also { it[it.lastIndex] = Block.AIR - } + }*/ + + private val groundDepthBlockWall = params.terragenTiles + private val groundDepthBlockTERR = groundDepthBlockWall private fun Double.tiered(tiers: List): Int { tiers.reversed().forEachIndexed { index, it -> @@ -418,8 +424,13 @@ internal class TerragenTest(val params: TerragenParams) : NoiseMaker { Block.AIR to Color(0f, 0f, 0f, 1f), Block.DIRT to Color(0.588f, 0.45f, 0.3f, 1f), Block.STONE to Color(0.4f, 0.4f, 0.4f, 1f), - Block.STONE_SLATE to Color(0.2f, 0.2f, 0.2f, 1f), - Block.STONE_MARBLE to Color(0.8f, 0.8f, 0.8f, 1f) + Block.STONE_GNEISS to Color(0.2f, 0.2f, 0.2f, 1f), + Block.STONE_MARBLE to Color(0.8f, 0.8f, 0.8f, 1f), + Block.STONE_ORTHOCLASE to Color(0xa3836bff.toInt()), + Block.STONE_PLAGIOCLASE to Color(0xaa998fff.toInt()), + Block.STONE_MICROCLINE to Color(0x9ea3adff.toInt()), + Block.STONE_BASALT to Color(0x3f3e3fff.toInt()), + Block.SANDSTONE to Color(0xe0c688ff.toInt()) ) private val COPPER_ORE = 0x00e9c8ff.toInt() @@ -445,6 +456,8 @@ internal class TerragenTest(val params: TerragenParams) : NoiseMaker { private val terragenYscaling = (NOISEBOX_HEIGHT / 2400.0).pow(0.75) private val terragenTiers = (params.terragenTiers).map { it * terragenYscaling } // pow 1.0 for 1-to-1 scaling; 0.75 is used to make deep-rock layers actually deep for huge world size + private fun ItemID.isRock() = this.substringAfter(':').toInt() in 16 until 32 + override fun draw(x: Int, y: Int, noiseValue: List, outTex: Pixmap) { val terr = noiseValue[0].tiered(terragenTiers) val cave = if (noiseValue[1] < 0.5) 0 else 1 @@ -470,20 +483,20 @@ internal class TerragenTest(val params: TerragenParams) : NoiseMaker { outTex.drawPixel(x, y, if (water) WATER else if (waterShell) { - if ((terrBlockNoAir == Block.STONE || terrBlockNoAir == Block.STONE_SLATE)) + if (terrBlockNoAir.isRock()) ore ?: blockToCol[terrBlockNoAir]!!.toRGBA() else blockToCol[terrBlockNoAir]!!.toRGBA() } else if (oil) OIL else if (oilShell) { - if ((terrBlockNoAir == Block.STONE || terrBlockNoAir == Block.STONE_SLATE)) + if (terrBlockNoAir.isRock()) ore ?: blockToCol[terrBlockNoAir]!!.toRGBA() else blockToCol[terrBlockNoAir]!!.toRGBA() } else if (lava) LAVA - else if (ore != null && (terrBlock == Block.STONE || terrBlock == Block.STONE_SLATE)) ore + else if (ore != null && (terrBlock.isRock())) ore else if (wallBlock == Block.AIR && terrBlock == Block.AIR) BACK else blockToCol[terrBlock]!!.toRGBA() ) diff --git a/work_files/graphics/terrain/terrain_variable_subtiling_full.kra b/work_files/graphics/terrain/terrain_variable_subtiling_full.kra index 47ef49ec1..aca40623e 100644 --- a/work_files/graphics/terrain/terrain_variable_subtiling_full.kra +++ b/work_files/graphics/terrain/terrain_variable_subtiling_full.kra @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:761909f9941fdd9aa6f9ac76d74e87fc5e1083c4fde6ef7717e3ce86a963157e -size 1724763 +oid sha256:5c652cbcba347b5dabc1efbf163519d9c4c8f201503db8a2145b528920984418 +size 1809711