1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Fix belt planner

This commit is contained in:
tobspr
2020-06-17 15:57:34 +02:00
parent 2c0f0f2152
commit a6ed85e9da
4 changed files with 28 additions and 2 deletions

View File

@@ -1,4 +1,9 @@
export const CHANGELOG = [
{
version: "1.1.16",
date: "unreleased",
entries: ["Fix belt planner not placing the last belt"],
},
{
version: "1.1.15",
date: "17.06.2020",

View File

@@ -393,9 +393,9 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
const pathFromCorner = mouseTile.sub(this.currentDirectionLockCorner);
const deltaFromCorner = pathFromCorner.normalize().round();
const lengthFromCorner = Math_round(pathFromCorner.length());
rotation = (Math.round(Math_degrees(deltaFromCorner.angle()) / 90) * 90 + 360) % 360;
if (lengthFromCorner > 0) {
rotation = (Math.round(Math_degrees(deltaFromCorner.angle()) / 90) * 90 + 360) % 360;
for (let i = 0; i < lengthFromCorner + 1; ++i) {
result.push({
tile: currentPos.copy(),
@@ -403,6 +403,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
});
currentPos.addInplace(deltaFromCorner);
}
} else {
// Finish last one
result.push({
tile: currentPos.copy(),
rotation,
});
}
return result;
}