mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Add OR gate and different colors of wire based on the value
This commit is contained in:
@@ -289,7 +289,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
const mousePosition = this.root.app.mousePosition;
|
||||
if (!mousePosition) {
|
||||
// Not on screen
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const worldPos = this.root.camera.screenToWorld(mousePosition);
|
||||
@@ -298,8 +298,10 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
if (contents) {
|
||||
if (this.root.logic.tryDeleteBuilding(contents)) {
|
||||
this.root.soundProxy.playUi(SOUNDS.destroyBuilding);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -637,8 +639,9 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
this.currentlyDragging = true;
|
||||
this.currentlyDeleting = true;
|
||||
this.lastDragTile = this.root.camera.screenToWorld(pos).toTileSpace();
|
||||
this.deleteBelowCursor();
|
||||
return STOP_PROPAGATION;
|
||||
if (this.deleteBelowCursor()) {
|
||||
return STOP_PROPAGATION;
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel placement
|
||||
|
||||
@@ -14,15 +14,17 @@ export class HUDLeverToggle extends BaseHUDPart {
|
||||
* @param {enumMouseButton} button
|
||||
*/
|
||||
downPreHandler(pos, button) {
|
||||
if (button === enumMouseButton.left) {
|
||||
const tile = this.root.camera.screenToWorld(pos).toTileSpace();
|
||||
const contents = this.root.map.getLayerContentXY(tile.x, tile.y, enumLayer.regular);
|
||||
|
||||
if (contents) {
|
||||
const leverComp = contents.components.Lever;
|
||||
if (leverComp) {
|
||||
const tile = this.root.camera.screenToWorld(pos).toTileSpace();
|
||||
const contents = this.root.map.getLayerContentXY(tile.x, tile.y, enumLayer.regular);
|
||||
if (contents) {
|
||||
const leverComp = contents.components.Lever;
|
||||
if (leverComp) {
|
||||
if (button === enumMouseButton.left) {
|
||||
leverComp.toggled = !leverComp.toggled;
|
||||
return STOP_PROPAGATION;
|
||||
} else if (button === enumMouseButton.right) {
|
||||
this.root.logic.tryDeleteBuilding(contents);
|
||||
return STOP_PROPAGATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,14 @@ import { HUDBaseToolbar } from "./base_toolbar";
|
||||
import { MetaWireBuilding } from "../../buildings/wire";
|
||||
import { MetaConstantSignalBuilding } from "../../buildings/constant_signal";
|
||||
import { MetaLogicGateBuilding } from "../../buildings/logic_gate";
|
||||
import { MetaLeverBuilding } from "../../buildings/lever";
|
||||
|
||||
const supportedBuildings = [MetaWireBuilding, MetaConstantSignalBuilding, MetaLogicGateBuilding];
|
||||
const supportedBuildings = [
|
||||
MetaWireBuilding,
|
||||
MetaConstantSignalBuilding,
|
||||
MetaLogicGateBuilding,
|
||||
MetaLeverBuilding,
|
||||
];
|
||||
|
||||
export class HUDWiresToolbar extends HUDBaseToolbar {
|
||||
constructor(root) {
|
||||
|
||||
Reference in New Issue
Block a user