From ca12bcaaa337ef48819c232a381d3d841fd5827c Mon Sep 17 00:00:00 2001 From: Daan Breur Date: Sat, 27 Nov 2021 15:26:54 +0100 Subject: [PATCH] Use shape-percentage when generating shapes. Signed-off-by: Daan Breur --- src/js/game/map_chunk.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/js/game/map_chunk.js b/src/js/game/map_chunk.js index 2283a674..00d41408 100644 --- a/src/js/game/map_chunk.js +++ b/src/js/game/map_chunk.js @@ -203,7 +203,19 @@ export class MapChunk { weights[enumSubShape.windmill] = 0; } - if (distanceToOriginInChunks < 10) { + if (rng.nextRange(0, 100) <= this.root.map.fullShapePercentage) { + // Spawn full shape based on percentage. + const subShape = this.internalGenerateRandomSubShape(rng, weights); + subShapes = [subShape, subShape, subShape, subShape]; + } else if (rng.nextRange(0, 100) <= this.root.map.wierdShapePercentage) { + // Spawn wierd shape based on percentage. + subShapes = [ + this.internalGenerateRandomSubShape(rng, weights), + this.internalGenerateRandomSubShape(rng, weights), + this.internalGenerateRandomSubShape(rng, weights), + this.internalGenerateRandomSubShape(rng, weights), + ]; + } else if (distanceToOriginInChunks < 10) { // Initial chunk patches always have the same shape const subShape = this.internalGenerateRandomSubShape(rng, weights); subShapes = [subShape, subShape, subShape, subShape];