mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Merge da8fea152a
into 958d400ff5
This commit is contained in:
commit
280559a4b3
@ -226,17 +226,7 @@ export class MapChunk {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makes sure windmills never spawn as whole
|
this.filterShapePatch({ subShapes, distanceToOriginInChunks });
|
||||||
let windmillCount = 0;
|
|
||||||
for (let i = 0; i < subShapes.length; ++i) {
|
|
||||||
if (subShapes[i] === enumSubShape.windmill) {
|
|
||||||
++windmillCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (windmillCount > 1) {
|
|
||||||
subShapes[0] = enumSubShape.rect;
|
|
||||||
subShapes[1] = enumSubShape.rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
const definition = this.root.shapeDefinitionMgr.getDefinitionFromSimpleShapes(subShapes);
|
const definition = this.root.shapeDefinitionMgr.getDefinitionFromSimpleShapes(subShapes);
|
||||||
this.internalGeneratePatch(
|
this.internalGeneratePatch(
|
||||||
@ -246,6 +236,27 @@ export class MapChunk {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes sure windmills never spawn as whole
|
||||||
|
*
|
||||||
|
* @param {object} param0
|
||||||
|
* @param {[enumSubShape, enumSubShape, enumSubShape, enumSubShape]} param0.subShapes
|
||||||
|
* @param {number} param0.distanceToOriginInChunks
|
||||||
|
*/
|
||||||
|
filterShapePatch({ subShapes, distanceToOriginInChunks }) {
|
||||||
|
let windmillCount = 0;
|
||||||
|
for (let i = 0; i < subShapes.length; ++i) {
|
||||||
|
if (subShapes[i] === enumSubShape.windmill) {
|
||||||
|
++windmillCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (windmillCount > 1) {
|
||||||
|
subShapes[0] = enumSubShape.rect;
|
||||||
|
subShapes[1] = enumSubShape.rect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chooses a random shape with the given weights
|
* Chooses a random shape with the given weights
|
||||||
* @param {RandomNumberGenerator} rng
|
* @param {RandomNumberGenerator} rng
|
||||||
|
Loading…
Reference in New Issue
Block a user