1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Click the storage to switch the display

This commit is contained in:
isaisstillalive 2020-07-01 22:14:38 +09:00
parent f3760e3e0f
commit 71fbf8cad9

View File

@ -264,10 +264,11 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
staticComp.rotation = this.currentBaseRotation;
}
}
/**
* Tries to delete the building under the mouse
* Get the building under the mouse
*/
deleteBelowCursor() {
getContentBelowCursor() {
const mousePosition = this.root.app.mousePosition;
if (!mousePosition) {
// Not on screen
@ -276,7 +277,14 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
const worldPos = this.root.camera.screenToWorld(mousePosition);
const tile = worldPos.toTileSpace();
const contents = this.root.map.getTileContent(tile, this.root.currentLayer);
return this.root.map.getTileContent(tile, this.root.currentLayer);
}
/**
* Tries to delete the building under the mouse
*/
deleteBelowCursor() {
const contents = this.getContentBelowCursor();
if (contents) {
if (this.root.logic.tryDeleteBuilding(contents)) {
this.root.soundProxy.playUi(SOUNDS.destroyBuilding);
@ -692,6 +700,16 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
if (button === enumMouseButton.right && metaBuilding) {
this.currentMetaBuilding.set(null);
}
// Action
if (button === enumMouseButton.left && !metaBuilding) {
this.lastDragTile = this.root.camera.screenToWorld(pos).toTileSpace();
const content = this.getContentBelowCursor();
if (content && content.components.Storage) {
content.components.Storage.cycleDisplayType();
// return STOP_PROPAGATION;
}
}
}
/**