From 6da023546d8243c611841514f37e1191089b5394 Mon Sep 17 00:00:00 2001 From: Jakob Hellermann Date: Sat, 27 Jun 2020 22:18:29 +0200 Subject: [PATCH 1/3] press alt key in belt planner to reverse direction --- src/js/game/hud/parts/building_placer_logic.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/js/game/hud/parts/building_placer_logic.js b/src/js/game/hud/parts/building_placer_logic.js index 7d2cbb71..0e787700 100644 --- a/src/js/game/hud/parts/building_placer_logic.js +++ b/src/js/game/hud/parts/building_placer_logic.js @@ -558,8 +558,15 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { // Figure which points the line visits const worldPos = this.root.camera.screenToWorld(mousePosition); - const mouseTile = worldPos.toTileSpace(); - const startTile = this.lastDragTile; + let endTile = worldPos.toTileSpace(); + let startTile = this.lastDragTile; + + // if the alt key is pressed, reverse belt planner direction by switching start and end tile + if (this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeInverse).pressed) { + let tmp = startTile; + startTile = endTile; + endTile = tmp; + } // Place from start to corner const pathToCorner = this.currentDirectionLockCorner.sub(startTile); @@ -580,7 +587,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { } // Place from corner to end - const pathFromCorner = mouseTile.sub(this.currentDirectionLockCorner); + const pathFromCorner = endTile.sub(this.currentDirectionLockCorner); const deltaFromCorner = pathFromCorner.normalize().round(); const lengthFromCorner = Math.round(pathFromCorner.length()); From bbeee11057d566f389288472a8359ccc91cc57ba Mon Sep 17 00:00:00 2001 From: hexagonhexagon Date: Sat, 27 Jun 2020 22:52:25 -0400 Subject: [PATCH 2/3] Pressing Q on the same building twice clears the cursor. --- src/js/game/hud/parts/building_placer_logic.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/game/hud/parts/building_placer_logic.js b/src/js/game/hud/parts/building_placer_logic.js index 7d2cbb71..b9acd2ad 100644 --- a/src/js/game/hud/parts/building_placer_logic.js +++ b/src/js/game/hud/parts/building_placer_logic.js @@ -322,7 +322,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { // Try to extract the building const extracted = this.hack_reconstructMetaBuildingAndVariantFromBuilding(contents); - if (!extracted) { + // If the building we are picking is the same as the one we have, clear the cursor. + if ( + !extracted || + (extracted.metaBuilding === this.currentMetaBuilding.get() && + extracted.variant === this.currentVariant.get()) + ) { this.currentMetaBuilding.set(null); return; } From 4c5043378f584d83941d2c6b7c9295d02154af30 Mon Sep 17 00:00:00 2001 From: hexagonhexagon Date: Sun, 28 Jun 2020 01:18:49 -0400 Subject: [PATCH 3/3] Fix issue where pressing B just after loading crashes the game. --- src/js/game/hub_goals.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/js/game/hub_goals.js b/src/js/game/hub_goals.js index 3f4f1cf3..67966384 100644 --- a/src/js/game/hub_goals.js +++ b/src/js/game/hub_goals.js @@ -106,13 +106,14 @@ export class HubGoals extends BasicSerializableObject { // Allow quickly switching goals in dev mode if (G_IS_DEV) { - if (G_IS_DEV) { - window.addEventListener("keydown", ev => { - if (ev.key === "b") { + window.addEventListener("keydown", ev => { + if (ev.key === "b") { + // root is not guaranteed to exist within ~0.5s after loading in + if (this.root && this.root.app && this.root.app.gameAnalytics) { this.onGoalCompleted(); } - }); - } + } + }); } }