From 86aba0d08abea1b5d02c5c4efa53062132fda8de Mon Sep 17 00:00:00 2001 From: DJ1TJOO Date: Thu, 11 Mar 2021 19:00:44 +0100 Subject: [PATCH 1/2] Settings default to null instead of adding null to function --- src/js/platform/achievement_provider.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/platform/achievement_provider.js b/src/js/platform/achievement_provider.js index 31973880..040f3e9f 100644 --- a/src/js/platform/achievement_provider.js +++ b/src/js/platform/achievement_provider.js @@ -324,7 +324,7 @@ export class AchievementCollection { * @param {string} key - Maps to an Achievement * @param {any} data - Data received from signal dispatches for validation */ - unlock(key, data) { + unlock(key, data = null) { if (!this.map.has(key)) { return; } @@ -594,7 +594,7 @@ export class AchievementCollection { /** @param {Achievement} achievement */ initStore100Unique({ key }) { - this.unlock(key, null); + this.unlock(key); } /** @returns {boolean} */ @@ -604,7 +604,7 @@ export class AchievementCollection { /** @param {Achievement} achievement */ initStoreShape({ key }) { - this.unlock(key, null); + this.unlock(key); } /** @returns {boolean} */ From 5d86b89bce0f23c40ff35e7e347d00f5c9b369dc Mon Sep 17 00:00:00 2001 From: DJ1TJOO Date: Thu, 11 Mar 2021 19:15:42 +0100 Subject: [PATCH 2/2] Removed required null for achievementCheck dispatch --- src/js/game/achievement_proxy.js | 4 ++-- src/js/game/root.js | 2 +- src/js/game/shape_definition_manager.js | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/js/game/achievement_proxy.js b/src/js/game/achievement_proxy.js index ed05b700..2ae9ee52 100644 --- a/src/js/game/achievement_proxy.js +++ b/src/js/game/achievement_proxy.js @@ -46,7 +46,7 @@ export class AchievementProxy { } initialize() { - this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.darkMode, null); + this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.darkMode); if (this.has(ACHIEVEMENTS.mam)) { this.root.signals.entityAdded.add(this.onMamFailure, this); @@ -136,7 +136,7 @@ export class AchievementProxy { this.root.signals.entityDestroyed.add(this.onMamFailure, this); } - this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.mam, null); + this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.mam); // reset on every level this.root.savegame.currentData.stats.failedMam = false; diff --git a/src/js/game/root.js b/src/js/game/root.js index 82d1e49f..c58c5abc 100644 --- a/src/js/game/root.js +++ b/src/js/game/root.js @@ -181,7 +181,7 @@ export class GameRoot { freeEntityAreaBeforeBuild: /** @type {TypedSignal<[Entity]>} */ (new Signal()), // Called with an achievement key and necessary args to validate it can be unlocked. - achievementCheck: /** @type {TypedSignal<[string, any]>} */ (new Signal()), + achievementCheck: /** @type {TypedSignal<[string, ...(any)[]]>} */ (new Signal()), bulkAchievementCheck: /** @type {TypedSignal<(string|any)[]>} */ (new Signal()), }; diff --git a/src/js/game/shape_definition_manager.js b/src/js/game/shape_definition_manager.js index 89203f1e..92fc9538 100644 --- a/src/js/game/shape_definition_manager.js +++ b/src/js/game/shape_definition_manager.js @@ -97,7 +97,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject { const rightSide = definition.cloneFilteredByQuadrants([2, 3]); const leftSide = definition.cloneFilteredByQuadrants([0, 1]); - this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.cutShape, null); + this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.cutShape); return /** @type {[ShapeDefinition, ShapeDefinition]} */ (this.operationCache[key] = [ this.registerOrReturnHandle(rightSide), @@ -140,7 +140,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject { const rotated = definition.cloneRotateCW(); - this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.rotateShape, null); + this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.rotateShape); return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle( rotated @@ -195,7 +195,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject { return /** @type {ShapeDefinition} */ (this.operationCache[key]); } - this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.stackShape, null); + this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.stackShape); const stacked = lowerDefinition.cloneAndStackWith(upperDefinition); return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle( @@ -215,7 +215,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject { return /** @type {ShapeDefinition} */ (this.operationCache[key]); } - this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.paintShape, null); + this.root.signals.achievementCheck.dispatch(ACHIEVEMENTS.paintShape); const colorized = definition.cloneAndPaintWith(color); return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(