mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-17 13:29:20 +00:00
Shiff key + Click enter Belt planner mode until next click
This commit is contained in:
parent
ab24e1afae
commit
f3d034d4b4
@ -86,18 +86,18 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
*/
|
*/
|
||||||
this.lastDragTile = null;
|
this.lastDragTile = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keep holding direction lock
|
||||||
|
* @type {?boolean}
|
||||||
|
*/
|
||||||
|
this.currentlyDirectionLock = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The side for direction lock
|
* The side for direction lock
|
||||||
* @type {number} (0|1)
|
* @type {number} (0|1)
|
||||||
*/
|
*/
|
||||||
this.currentDirectionLockSide = 0;
|
this.currentDirectionLockSide = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Keep holding direction lock while dragging
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.keepDirectionLock = false;
|
|
||||||
|
|
||||||
this.initializeBindings();
|
this.initializeBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,12 +181,13 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
*/
|
*/
|
||||||
get isDirectionLockActive() {
|
get isDirectionLockActive() {
|
||||||
const metaBuilding = this.currentMetaBuilding.get();
|
const metaBuilding = this.currentMetaBuilding.get();
|
||||||
return (
|
if (!(metaBuilding && metaBuilding.getHasDirectionLockAvailable())) {
|
||||||
this.keepDirectionLock ||
|
return false;
|
||||||
(metaBuilding &&
|
}
|
||||||
metaBuilding.getHasDirectionLockAvailable() &&
|
if (this.currentlyDirectionLock !== null) {
|
||||||
this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.lockBeltDirection).pressed)
|
return this.currentlyDirectionLock;
|
||||||
);
|
}
|
||||||
|
return this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.lockBeltDirection).pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -235,6 +236,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
this.currentlyDeleting = false;
|
this.currentlyDeleting = false;
|
||||||
this.initialPlacementVector = null;
|
this.initialPlacementVector = null;
|
||||||
this.lastDragTile = null;
|
this.lastDragTile = null;
|
||||||
|
this.currentlyDirectionLock = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -650,13 +652,21 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
|
|
||||||
// Placement
|
// Placement
|
||||||
if (button === enumMouseButton.left && metaBuilding) {
|
if (button === enumMouseButton.left && metaBuilding) {
|
||||||
|
// Check for direction lock
|
||||||
|
if (this.currentlyDirectionLock) {
|
||||||
|
if (this.lastDragTile && this.currentlyDragging) {
|
||||||
|
this.executeDirectionLockedPlacement();
|
||||||
|
this.abortDragging();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.currentlyDragging = true;
|
this.currentlyDragging = true;
|
||||||
this.currentlyDeleting = false;
|
this.currentlyDeleting = false;
|
||||||
this.lastDragTile = this.root.camera.screenToWorld(pos).toTileSpace();
|
this.lastDragTile = this.root.camera.screenToWorld(pos).toTileSpace();
|
||||||
|
|
||||||
if (this.isDirectionLockActive) {
|
this.currentlyDirectionLock = this.isDirectionLockActive;
|
||||||
this.keepDirectionLock = true;
|
if (!this.currentlyDirectionLock) {
|
||||||
} else {
|
|
||||||
// Place initial building, but only if direction lock is not active
|
// Place initial building, but only if direction lock is not active
|
||||||
if (this.tryPlaceCurrentBuildingAt(this.lastDragTile)) {
|
if (this.tryPlaceCurrentBuildingAt(this.lastDragTile)) {
|
||||||
this.root.soundProxy.playUi(metaBuilding.getPlacementSound());
|
this.root.soundProxy.playUi(metaBuilding.getPlacementSound());
|
||||||
@ -691,8 +701,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
const metaBuilding = this.currentMetaBuilding.get();
|
const metaBuilding = this.currentMetaBuilding.get();
|
||||||
if ((metaBuilding || this.currentlyDeleting) && this.lastDragTile) {
|
if ((metaBuilding || this.currentlyDeleting) && this.lastDragTile) {
|
||||||
// Check for direction lock
|
// Check for direction lock
|
||||||
if (this.isDirectionLockActive) {
|
if (this.currentlyDirectionLock) {
|
||||||
this.keepDirectionLock = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -789,11 +798,9 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for direction lock
|
if (this.currentlyDirectionLock) {
|
||||||
if (this.lastDragTile && this.currentlyDragging && this.isDirectionLockActive) {
|
return;
|
||||||
this.executeDirectionLockedPlacement();
|
|
||||||
}
|
}
|
||||||
this.keepDirectionLock = false;
|
|
||||||
|
|
||||||
this.abortDragging();
|
this.abortDragging();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user