From 0cccf1cb6efb4ddfbfbd0a9c7b96ec4e71123818 Mon Sep 17 00:00:00 2001 From: EmeraldBlock Date: Wed, 21 Oct 2020 17:02:20 -0500 Subject: [PATCH] Add option to level up normally --- src/js/game/hud/parts/sandbox_controller.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/js/game/hud/parts/sandbox_controller.js b/src/js/game/hud/parts/sandbox_controller.js index 31dc9dac..200ac053 100644 --- a/src/js/game/hud/parts/sandbox_controller.js +++ b/src/js/game/hud/parts/sandbox_controller.js @@ -26,7 +26,7 @@ export class HUDSandboxController extends BaseHUDPart {
- + @@ -54,12 +54,15 @@ export class HUDSandboxController extends BaseHUDPart {
+
+ + +
-
` @@ -67,13 +70,15 @@ export class HUDSandboxController extends BaseHUDPart { const bind = (selector, handler) => this.trackClicks(this.element.querySelector(selector), handler); - bind(".giveBlueprints", this.giveBlueprints); + bind(".levelOverride", this.promptOverrideLevel); + bind(".levelUp", this.tryLevelUp) bind(".bigMinus", () => this.modifyAll(-100)); bind(".bigPlus", () => this.modifyAll(100)); + bind(".giveBlueprints", this.giveBlueprints); + bind(".levelToggle .reset", this.resetLevel); bind(".levelToggle .minus", () => this.modifyLevel(-1)); bind(".levelToggle .plus", () => this.modifyLevel(1)); - bind(".levelOverride", this.promptOverrideLevel); bind(".upgradesBelt .reset", () => this.resetUpgrade("belt")); bind(".upgradesBelt .minus", () => this.modifyUpgrade("belt", -1)); @@ -188,7 +193,7 @@ export class HUDSandboxController extends BaseHUDPart { const dialog = new DialogWithForm({ app: this.root.app, title: "Override Level", - desc: "Enter shape to override with:", + desc: "Enter a shape to override with:", formElements: [signalValueInput], buttons: ["cancel:bad:escape", "ok:good:enter"], closeButton: false, @@ -214,6 +219,12 @@ export class HUDSandboxController extends BaseHUDPart { ); } + tryLevelUp() { + if (!this.root.hubGoals.isEndOfDemoReached()) { + this.root.hubGoals.onGoalCompleted(); + } + } + initialize() { // Allow toggling the controller overlay this.root.gameState.inputReciever.keydown.add(key => {