Fixes for the pipette

This commit is contained in:
tobspr 2020-06-21 21:59:35 +02:00
parent 76b619e4e7
commit ba52edf7a4
3 changed files with 10 additions and 3 deletions

View file

@ -60,6 +60,11 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
* Starts the pipette function
*/
startPipette() {
// Disable in overview
if (this.root.camera.getIsMapOverlayActive()) {
return;
}
const mousePosition = this.root.app.mousePosition;
if (!mousePosition) {
// Not on screen
@ -69,7 +74,9 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
const worldPos = this.root.camera.screenToWorld(mousePosition);
const tile = worldPos.toTileSpace();
const contents = this.root.map.getTileContent(tile);
if (contents) {
// Make sure we selected something, and also make sure it's not a special entity
if (contents && !contents.components.Unremovable) {
const blueprint = PipetteBlueprint.fromEntity(contents);
// Notice: Order here matters, since pipetteExecuted clears the blueprint