1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-17 04:01:51 +00:00

Use shape-percentage when generating shapes.

Signed-off-by: Daan Breur <git@daanbreur.systems>
This commit is contained in:
Daan Breur 2021-11-27 15:26:54 +01:00
parent 3897b41d45
commit ca12bcaaa3
No known key found for this signature in database
GPG Key ID: FAD44580052ECA57

View File

@ -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];