diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemDescriptor.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemDescriptor.kt index f915c663..2a76eb09 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemDescriptor.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemDescriptor.kt @@ -214,7 +214,7 @@ data class ItemDescriptor( return ref.type.factory(ref, jConfig, jParameters, count) } catch (err: Throwable) { - LOGGER.error("Error while generating randomized item '$name' using script $builder", err) + LOGGER.error("Error while building item '$name' using script $builder", err) return ref.type.factory(ref, ref.json, parameters.deepCopy(), count) } } diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/TileDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/TileDefinition.kt index 704f9971..5c4a55be 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/TileDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/TileDefinition.kt @@ -50,7 +50,7 @@ data class TileDefinition( val cascading: Boolean = false, val falling: Boolean = false, val foregroundOnly: Boolean = collisionKind != CollisionType.BLOCK, - val supportsMods: Boolean = !(falling || !cascading || collisionKind != CollisionType.BLOCK), + val supportsMods: Boolean = !(falling || cascading || collisionKind != CollisionType.BLOCK), val blocksLiquidFlow: Boolean = collisionKind.isSolidCollision, ) : IRenderableTile, IThingWithDescription by descriptionData { init { diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/world/TerrainSelectorParameters.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/world/TerrainSelectorParameters.kt index de91509a..fbf4f5de 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/world/TerrainSelectorParameters.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/world/TerrainSelectorParameters.kt @@ -12,7 +12,7 @@ data class TerrainSelectorParameters( val baseHeight: Double, val worldHeight: Int = 0, val seed: Long = 0L, - val commonality: Double = 0.0 + val commonality: Double = 1.0 ) { fun withSeed(seed: Long) = copy(seed = seed) fun withCommonality(commonality: Double) = copy(commonality = commonality) diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/terrain/RidgeBlocksTerrainSelector.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/terrain/RidgeBlocksTerrainSelector.kt index 33ecc58d..c4551857 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/terrain/RidgeBlocksTerrainSelector.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/terrain/RidgeBlocksTerrainSelector.kt @@ -74,8 +74,8 @@ class RidgeBlocksTerrainSelector(data: Data, parameters: TerrainSelectorParamete if (parameters.commonality <= 0.0) { return 0.0 } else { - val x = perlin[x.toDouble(), y.toDouble()] - val y = perlin[y.toDouble(), x] + val x = x + perlin[x.toDouble(), y.toDouble()] + val y = y + perlin[y.toDouble(), x] return (ridge1[x, y] - ridge2[x, y]) * parameters.commonality + data.bias } } diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/terrain/WormCaveTerrainSelector.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/terrain/WormCaveTerrainSelector.kt index dcd63ebc..149c359d 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/terrain/WormCaveTerrainSelector.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/terrain/WormCaveTerrainSelector.kt @@ -96,31 +96,34 @@ class WormCaveTerrainSelector(data: Data, parameters: TerrainSelectorParameters) else 1.0 - wormRadius *= taperFactor + //wormRadius *= taperFactor // carve out worm area - val size = ceil(wormRadius) - var dx = -size - var dy = -size + if (wormRadius >= 1.0) { + val size = ceil(wormRadius) + var dx = -size + var dy = -size - while (dx <= size) { - while (dy <= size) { - val m = sqrt(dx * dx + dy * dy) + while (dx <= size) { + while (dy <= size) { + val m = sqrt(dx * dx + dy * dy) - if (m <= wormRadius) { - // TODO: maybe roundToInt()? - val x = (dx + worm.pos.x).toInt() - val y = (dy + worm.pos.y).toInt() + if (m < wormRadius) { + // TODO: maybe roundToInt()? + val x = (dx + worm.pos.x).toInt() + val y = (dy + worm.pos.y).toInt() - if (isInside(x, y)) { - this[x, y] = this[x, y].coerceAtLeast(wormRadius - m) + if (isInside(x, y)) { + this[x, y] = this[x, y].coerceAtLeast(wormRadius - m) + } } + + dy += 1.0 } - dy += 1.0 + dy = -size + dx += 1.0 } - - dx += 1.0 } // move the worm, slowing down a bit as we