mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Merge pull request #325 from jakobhellermann/master
press alt key in belt planner to reverse direction
This commit is contained in:
commit
542cc89f94
@ -558,8 +558,15 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
|
||||
// Figure which points the line visits
|
||||
const worldPos = this.root.camera.screenToWorld(mousePosition);
|
||||
const mouseTile = worldPos.toTileSpace();
|
||||
const startTile = this.lastDragTile;
|
||||
let endTile = worldPos.toTileSpace();
|
||||
let startTile = this.lastDragTile;
|
||||
|
||||
// if the alt key is pressed, reverse belt planner direction by switching start and end tile
|
||||
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeInverse).pressed) {
|
||||
let tmp = startTile;
|
||||
startTile = endTile;
|
||||
endTile = tmp;
|
||||
}
|
||||
|
||||
// Place from start to corner
|
||||
const pathToCorner = this.currentDirectionLockCorner.sub(startTile);
|
||||
@ -580,7 +587,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
}
|
||||
|
||||
// Place from corner to end
|
||||
const pathFromCorner = mouseTile.sub(this.currentDirectionLockCorner);
|
||||
const pathFromCorner = endTile.sub(this.currentDirectionLockCorner);
|
||||
const deltaFromCorner = pathFromCorner.normalize().round();
|
||||
const lengthFromCorner = Math.round(pathFromCorner.length());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user