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

Further blueprint improvements

This commit is contained in:
tobspr
2020-05-27 15:03:36 +02:00
parent 19c770201f
commit dfe1e64b27
17 changed files with 159 additions and 152 deletions

View File

@@ -21,6 +21,7 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
keyActionMapper
.getBinding(KEYMAPPINGS.placement.abortBuildingPlacement)
.add(this.abortPlacement, this);
keyActionMapper.getBinding(KEYMAPPINGS.placement.rotateWhilePlacing).add(this.rotateBlueprint, this);
this.root.camera.downPreHandler.add(this.onMouseDown, this);
this.root.camera.movePreHandler.add(this.onMouseMove, this);
@@ -54,13 +55,13 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
return;
}
console.log("down");
const worldPos = this.root.camera.screenToWorld(pos);
const tile = worldPos.toTileSpace();
if (blueprint.tryPlace(this.root, tile)) {
if (!this.root.app.inputMgr.shiftIsDown) {
this.currentBlueprint.set(null);
}
// This actually feels weird
// if (!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeMultiple).currentlyDown) {
// this.currentBlueprint.set(null);
// }
}
}
@@ -81,6 +82,16 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
this.currentBlueprint.set(Blueprint.fromUids(this.root, uids));
}
rotateBlueprint() {
if (this.currentBlueprint.get()) {
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).currentlyDown) {
this.currentBlueprint.get().rotateCcw();
} else {
this.currentBlueprint.get().rotateCw();
}
}
}
/**
*
* @param {DrawParameters} parameters