mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
fix windmill shape generation - non recursive
This commit is contained in:
parent
b855613fcf
commit
d4666a99b8
@ -198,8 +198,13 @@ export class MapChunk {
|
|||||||
weights[enumSubShape.windmill] = 0;
|
weights[enumSubShape.windmill] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Makes sure windmills never spawn as whole
|
||||||
|
let windmillCount;
|
||||||
|
do {
|
||||||
|
windmillCount = 0;
|
||||||
if (distanceToOriginInChunks < 10) {
|
if (distanceToOriginInChunks < 10) {
|
||||||
// Initial chunk patches always have the same shape
|
// Initial chunk patches always have the same shape
|
||||||
|
weights[enumSubShape.windmill] = 0; // no whole windmills
|
||||||
const subShape = this.internalGenerateRandomSubShape(rng, weights);
|
const subShape = this.internalGenerateRandomSubShape(rng, weights);
|
||||||
subShapes = [subShape, subShape, subShape, subShape];
|
subShapes = [subShape, subShape, subShape, subShape];
|
||||||
} else if (distanceToOriginInChunks < 15) {
|
} else if (distanceToOriginInChunks < 15) {
|
||||||
@ -216,18 +221,12 @@ export class MapChunk {
|
|||||||
this.internalGenerateRandomSubShape(rng, weights),
|
this.internalGenerateRandomSubShape(rng, weights),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makes sure windmills never spawn as whole
|
|
||||||
let windmillCount = 0;
|
|
||||||
for (let i = 0; i < subShapes.length; ++i) {
|
for (let i = 0; i < subShapes.length; ++i) {
|
||||||
if (subShapes[i] === enumSubShape.windmill) {
|
if (subShapes[i] === enumSubShape.windmill) {
|
||||||
++windmillCount;
|
++windmillCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (windmillCount > 2) {
|
} while (windmillCount > 2);
|
||||||
this.internalGenerateShapePatch(rng, shapePatchSize, distanceToOriginInChunks);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const definition = this.root.shapeDefinitionMgr.getDefinitionFromSimpleShapes(subShapes);
|
const definition = this.root.shapeDefinitionMgr.getDefinitionFromSimpleShapes(subShapes);
|
||||||
this.internalGeneratePatch(
|
this.internalGeneratePatch(
|
||||||
|
Loading…
Reference in New Issue
Block a user