2021-03-01 23:07:21 +00:00
|
|
|
/* typehints:start */
|
|
|
|
import { Application } from "../application";
|
2021-03-03 16:59:56 +00:00
|
|
|
import { StorageComponent } from "../game/components/storage";
|
|
|
|
import { Entity } from "../game/entity";
|
|
|
|
import { GameRoot } from "../game/root";
|
|
|
|
import { ShapeDefinition } from "../game/shape_definition";
|
2021-03-01 23:07:21 +00:00
|
|
|
/* typehints:end */
|
|
|
|
|
|
|
|
export const ACHIEVEMENTS = {
|
2021-03-04 16:41:00 +00:00
|
|
|
belt500Tiles: "belt500Tiles",
|
|
|
|
blueprint100k: "blueprint100k",
|
|
|
|
blueprint1m: "blueprint1m",
|
|
|
|
completeLvl26: "completeLvl26",
|
|
|
|
cutShape: "cutShape",
|
2021-03-03 22:30:14 +00:00
|
|
|
darkMode: "darkMode",
|
2021-03-04 21:16:18 +00:00
|
|
|
irrelevantShape: "irrelevantShape",
|
2021-03-04 16:41:00 +00:00
|
|
|
level100: "level100",
|
|
|
|
level50: "level50",
|
2021-03-04 21:16:18 +00:00
|
|
|
oldLevel17: "oldLevel17",
|
|
|
|
openWires: "openWires",
|
2021-03-04 16:41:00 +00:00
|
|
|
paintShape: "paintShape",
|
|
|
|
place5000Wires: "place5000Wires",
|
|
|
|
placeBlueprint: "placeBlueprint",
|
2021-03-04 20:24:34 +00:00
|
|
|
play1h: "play1h",
|
|
|
|
play10h: "play10h",
|
|
|
|
play20h: "play20h",
|
2021-03-04 16:41:00 +00:00
|
|
|
produceLogo: "produceLogo",
|
|
|
|
produceMsLogo: "produceMsLogo",
|
|
|
|
produceRocket: "produceRocket",
|
|
|
|
rotateShape: "rotateShape",
|
|
|
|
stack4Layers: "stack4Layers",
|
|
|
|
stackShape: "stackShape",
|
|
|
|
store100Unique: "store100Unique",
|
|
|
|
storeShape: "storeShape",
|
|
|
|
unlockWires: "unlockWires",
|
2021-03-01 23:07:21 +00:00
|
|
|
};
|
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
const DARK_MODE = "dark";
|
2021-03-04 21:16:18 +00:00
|
|
|
const WIRE_LAYER = "wires";
|
2021-03-04 20:24:34 +00:00
|
|
|
const HOUR_1 = 3600; // Seconds
|
|
|
|
const HOUR_10 = HOUR_1 * 10;
|
|
|
|
const HOUR_20 = HOUR_1 * 20;
|
2021-03-04 16:41:00 +00:00
|
|
|
const SHAPE_BLUEPRINT = "CbCbCbRb:CwCwCwCw";
|
|
|
|
const SHAPE_LOGO = "RuCw--Cw:----Ru--";
|
|
|
|
const SHAPE_MS_LOGO = "RgRyRbRr";
|
|
|
|
const SHAPE_ROCKET = "CbCuCbCu:Sr------:--CrSrCr:CwCwCwCw";
|
2021-03-04 21:16:18 +00:00
|
|
|
const SHAPE_OLD_LEVEL_17 = "WrRgWrRg:CwCrCwCr:SgSgSgSg";
|
2021-03-03 16:59:56 +00:00
|
|
|
|
2021-03-01 23:07:21 +00:00
|
|
|
export class AchievementProviderInterface {
|
|
|
|
/** @param {Application} app */
|
|
|
|
constructor(app) {
|
|
|
|
this.app = app;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the achievement provider.
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
*/
|
|
|
|
initialize() {
|
|
|
|
abstract;
|
|
|
|
return Promise.reject();
|
|
|
|
}
|
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
/**
|
|
|
|
* Opportunity to do additional initialization work with the GameRoot.
|
|
|
|
* @param {GameRoot} root
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
*/
|
|
|
|
onLoad(root) {
|
|
|
|
abstract;
|
|
|
|
return Promise.reject();
|
|
|
|
}
|
|
|
|
|
2021-03-04 20:24:34 +00:00
|
|
|
/** @returns {boolean} */
|
|
|
|
hasLoaded() {
|
|
|
|
abstract;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
/**
|
|
|
|
* Call to activate an achievement with the provider
|
|
|
|
* @param {string} key - Maps to an Achievement
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
*/
|
|
|
|
activate(key) {
|
|
|
|
abstract;
|
|
|
|
return Promise.reject();
|
|
|
|
}
|
|
|
|
|
2021-03-01 23:07:21 +00:00
|
|
|
/**
|
|
|
|
* Checks if achievements are supported in the current build
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
hasAchievements() {
|
|
|
|
abstract;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Achievement {
|
2021-03-03 16:59:56 +00:00
|
|
|
/** @param {string} key - An ACHIEVEMENTS key */
|
|
|
|
constructor(key) {
|
2021-03-01 23:07:21 +00:00
|
|
|
this.key = key;
|
2021-03-03 16:59:56 +00:00
|
|
|
this.activate = null;
|
|
|
|
this.activatePromise = null;
|
2021-03-03 22:30:14 +00:00
|
|
|
this.receiver = null;
|
|
|
|
this.signal = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
isValid() {
|
|
|
|
return true;
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
isRelevant() {
|
2021-03-03 16:59:56 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
unlock() {
|
|
|
|
if (!this.activatePromise) {
|
|
|
|
this.activatePromise = this.activate(this.key);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.activatePromise;
|
2021-03-01 23:07:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AchievementCollection {
|
|
|
|
/**
|
2021-03-03 22:30:14 +00:00
|
|
|
* @param {function} activate - Resolves when provider activation is complete
|
2021-03-01 23:07:21 +00:00
|
|
|
*/
|
2021-03-03 22:30:14 +00:00
|
|
|
constructor(activate) {
|
2021-03-01 23:07:21 +00:00
|
|
|
this.map = new Map();
|
2021-03-03 16:59:56 +00:00
|
|
|
this.activate = activate;
|
2021-03-03 22:30:14 +00:00
|
|
|
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.belt500Tiles, {
|
|
|
|
isValid: this.isBelt500TilesValid,
|
|
|
|
signal: "entityAdded",
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.blueprint100k, {
|
|
|
|
isValid: this.isBlueprint100kValid,
|
|
|
|
signal: "shapeDelivered",
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.blueprint1m, {
|
|
|
|
isValid: this.isBlueprint1mValid,
|
|
|
|
signal: "shapeDelivered",
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.completeLvl26, this.createLevelOptions(26));
|
|
|
|
this.createAndSet(ACHIEVEMENTS.cutShape);
|
|
|
|
this.createAndSet(ACHIEVEMENTS.darkMode, {
|
|
|
|
isValid: this.isDarkModeValid,
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 21:16:18 +00:00
|
|
|
/*
|
|
|
|
*this.createAndSet(ACHIEVEMENTS.irrelevantShape, {
|
|
|
|
* isValid: this.isIrrelevantShapeValid,
|
|
|
|
* signal: "shapeDelivered",
|
|
|
|
*});
|
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.level100, this.createLevelOptions(100));
|
|
|
|
this.createAndSet(ACHIEVEMENTS.level50, this.createLevelOptions(50));
|
2021-03-04 21:16:18 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.oldLevel17, this.createShapeOptions(SHAPE_OLD_LEVEL_17));
|
|
|
|
this.createAndSet(ACHIEVEMENTS.openWires, {
|
|
|
|
isValid: this.isOpenWiresValid,
|
|
|
|
signal: "editModeChanged",
|
|
|
|
});
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.paintShape);
|
|
|
|
this.createAndSet(ACHIEVEMENTS.place5000Wires, {
|
|
|
|
isValid: this.isPlace5000WiresValid,
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.placeBlueprint, {
|
|
|
|
isValid: this.isPlaceBlueprintValid,
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 20:24:34 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.play1h, this.createTimeOptions(HOUR_1));
|
|
|
|
this.createAndSet(ACHIEVEMENTS.play10h, this.createTimeOptions(HOUR_10));
|
|
|
|
this.createAndSet(ACHIEVEMENTS.play20h, this.createTimeOptions(HOUR_20));
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.produceLogo, this.createShapeOptions(SHAPE_LOGO));
|
|
|
|
this.createAndSet(ACHIEVEMENTS.produceRocket, this.createShapeOptions(SHAPE_ROCKET));
|
|
|
|
this.createAndSet(ACHIEVEMENTS.produceMsLogo, this.createShapeOptions(SHAPE_MS_LOGO));
|
|
|
|
this.createAndSet(ACHIEVEMENTS.rotateShape);
|
|
|
|
this.createAndSet(ACHIEVEMENTS.stack4Layers, {
|
|
|
|
isValid: this.isStack4LayersValid,
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.stackShape);
|
|
|
|
this.createAndSet(ACHIEVEMENTS.store100Unique, {
|
|
|
|
isRelevant: this.isStore100UniqueRelevant,
|
|
|
|
isValid: this.isStore100UniqueValid,
|
|
|
|
signal: "shapeDelivered",
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.storeShape, {
|
|
|
|
isValid: this.isStoreShapeValid,
|
|
|
|
signal: "entityGotNewComponent",
|
2021-03-03 22:30:14 +00:00
|
|
|
});
|
2021-03-04 16:41:00 +00:00
|
|
|
this.createAndSet(ACHIEVEMENTS.unlockWires, this.createLevelOptions(20));
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @param {GameRoot} root */
|
|
|
|
initialize(root) {
|
|
|
|
this.root = root;
|
|
|
|
this.root.signals.achievementUnlocked.add(this.unlock, this);
|
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
for (let [key, achievement] of this.map.entries()) {
|
|
|
|
if (!achievement.isRelevant()) {
|
|
|
|
this.remove(key);
|
|
|
|
continue;
|
|
|
|
}
|
2021-03-03 16:59:56 +00:00
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
if (achievement.signal) {
|
|
|
|
achievement.receiver = this.unlock.bind(this, key);
|
|
|
|
this.root.signals[achievement.signal].add(achievement.receiver);
|
|
|
|
}
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
2021-03-01 23:07:21 +00:00
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
if (!this.hasDefaultReceivers()) {
|
|
|
|
this.root.signals.achievementUnlocked.remove(this.unlock);
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
2021-03-01 23:07:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} key - Maps to an Achievement
|
2021-03-03 22:30:14 +00:00
|
|
|
* @param {object} [options]
|
|
|
|
* @param {function} [options.isValid]
|
|
|
|
* @param {function} [options.isRelevant]
|
|
|
|
* @param {string} [options.signal]
|
2021-03-01 23:07:21 +00:00
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
createAndSet(key, options = {}) {
|
2021-03-03 16:59:56 +00:00
|
|
|
const achievement = new Achievement(key);
|
|
|
|
|
|
|
|
achievement.activate = this.activate;
|
|
|
|
|
2021-03-04 16:41:00 +00:00
|
|
|
if (options.isValid) {
|
|
|
|
achievement.isValid = options.isValid.bind(this);
|
|
|
|
}
|
2021-03-03 16:59:56 +00:00
|
|
|
|
2021-03-04 16:41:00 +00:00
|
|
|
if (options.isRelevant) {
|
|
|
|
achievement.isRelevant = options.isRelevant.bind(this);
|
|
|
|
}
|
2021-03-03 22:30:14 +00:00
|
|
|
|
2021-03-04 16:41:00 +00:00
|
|
|
if (options.signal) {
|
|
|
|
achievement.signal = options.signal;
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
this.map.set(key, achievement);
|
2021-03-01 23:07:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} key - Maps to an Achievement
|
2021-03-03 16:59:56 +00:00
|
|
|
* @param {*[]} [arguments] - Additional arguments received from signal dispatches
|
|
|
|
*/
|
|
|
|
unlock(key) {
|
|
|
|
if (!this.map.has(key)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const achievement = this.map.get(key);
|
|
|
|
|
|
|
|
if (!achievement.isValid(...arguments)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-04 16:41:00 +00:00
|
|
|
achievement.unlock()
|
|
|
|
.then(() => {
|
|
|
|
this.onActivate(null, key);
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
this.onActivate(err, key);
|
2021-03-03 16:59:56 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-04 16:41:00 +00:00
|
|
|
/**
|
|
|
|
* Cleans up after achievement activation attempt with the provider. Could
|
|
|
|
* utilize err to retry some number of times if needed.
|
|
|
|
* @param {?Error} err - Error is null if activation was successful
|
|
|
|
* @param {string} key - Maps to an Achievement
|
|
|
|
*/
|
|
|
|
onActivate (err, key) {
|
|
|
|
this.remove(key);
|
|
|
|
|
|
|
|
if (!this.hasDefaultReceivers()) {
|
|
|
|
this.root.signals.achievementUnlocked.remove(this.unlock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
/** @param {string} key - Maps to an Achievement */
|
|
|
|
remove(key) {
|
|
|
|
const achievement = this.map.get(key);
|
|
|
|
|
|
|
|
if (achievement.receiver) {
|
|
|
|
this.root.signals[achievement.signal].remove(achievement.receiver);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.map.delete(key);
|
|
|
|
}
|
|
|
|
|
2021-03-03 16:59:56 +00:00
|
|
|
hasDefaultReceivers() {
|
|
|
|
if (!this.map.size) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-03-03 22:30:14 +00:00
|
|
|
for (let achievement of this.map.values()) {
|
2021-03-03 16:59:56 +00:00
|
|
|
if (!achievement.signal) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-03-04 16:41:00 +00:00
|
|
|
createLevelOptions (level) {
|
|
|
|
return {
|
|
|
|
isRelevant: () => this.root.hubGoals.level < level,
|
|
|
|
isValid: (key, currentLevel) => currentLevel === level,
|
|
|
|
signal: "storyGoalCompleted"
|
|
|
|
}
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
2021-03-04 16:41:00 +00:00
|
|
|
createShapeOptions (shape) {
|
|
|
|
return {
|
|
|
|
isValid: (key, definition) => definition.cachedHash === shape
|
|
|
|
}
|
2021-03-01 23:07:21 +00:00
|
|
|
}
|
|
|
|
|
2021-03-04 20:24:34 +00:00
|
|
|
createTimeOptions (duration) {
|
|
|
|
return {
|
|
|
|
isRelevant: () => this.root.time.now() < duration,
|
|
|
|
isValid: () => this.root.time.now() >= duration,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-01 23:07:21 +00:00
|
|
|
/**
|
2021-03-03 16:59:56 +00:00
|
|
|
* @param {string} key
|
2021-03-04 16:41:00 +00:00
|
|
|
* @param {Entity} entity
|
2021-03-03 16:59:56 +00:00
|
|
|
* @returns {boolean}
|
2021-03-01 23:07:21 +00:00
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isBelt500TilesValid(key, entity) {
|
|
|
|
return entity.components.Belt && entity.components.Belt.assignedPath.totalLength >= 500;
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
2021-03-01 23:07:21 +00:00
|
|
|
|
2021-03-03 16:59:56 +00:00
|
|
|
/**
|
|
|
|
* @param {string} key
|
2021-03-04 16:41:00 +00:00
|
|
|
* @param {ShapeDefinition} definition
|
2021-03-03 16:59:56 +00:00
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isBlueprint100kValid(key, definition) {
|
|
|
|
return definition.cachedHash === SHAPE_BLUEPRINT &&
|
|
|
|
this.root.hubGoals.storedShapes[SHAPE_BLUEPRINT] >= 100000;
|
2021-03-01 23:07:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-03 16:59:56 +00:00
|
|
|
* @param {string} key
|
2021-03-04 16:41:00 +00:00
|
|
|
* @param {ShapeDefinition} definition
|
2021-03-03 16:59:56 +00:00
|
|
|
* @returns {boolean}
|
2021-03-01 23:07:21 +00:00
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isBlueprint1mValid(key, definition) {
|
|
|
|
return definition.cachedHash === SHAPE_BLUEPRINT &&
|
|
|
|
this.root.hubGoals.storedShapes[SHAPE_BLUEPRINT] >= 1000000;
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} key
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isDarkModeValid(key) {
|
|
|
|
return this.root.app.settings.currentData.settings.theme === DARK_MODE;
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
2021-03-04 21:16:18 +00:00
|
|
|
/**
|
|
|
|
* @param {string} key
|
|
|
|
* @param {ShapeDefinition} definition
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isIrrelevantShapeValid(key, definition) {
|
|
|
|
//return definition.cachedHash !== this.hubGoals.currentGoal.definition.cachedHash
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} key
|
|
|
|
* @param {string} currentLayer
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
isOpenWiresValid(key, currentLayer) {
|
|
|
|
return currentLayer === WIRE_LAYER;
|
|
|
|
}
|
|
|
|
|
2021-03-03 16:59:56 +00:00
|
|
|
/**
|
|
|
|
* @param {string} key
|
2021-03-04 16:41:00 +00:00
|
|
|
* @param {Entity} entity
|
2021-03-03 16:59:56 +00:00
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isPlace5000WiresValid(key, entity) {
|
|
|
|
return entity.components.Wire &&
|
|
|
|
entity.registered &&
|
|
|
|
entity.root.entityMgr.componentToEntity.Wire.length === 5000;
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} key
|
2021-03-04 16:41:00 +00:00
|
|
|
* @param {boolean} anyPlaced
|
2021-03-03 16:59:56 +00:00
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isPlaceBlueprintValid(key, anyPlaced) {
|
|
|
|
return anyPlaced;
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} key
|
|
|
|
* @param {ShapeDefinition} definition
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isStack4LayersValid(key, definition) {
|
|
|
|
return definition.layers.length === 4;
|
2021-03-03 16:59:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @returns {boolean} */
|
2021-03-04 16:41:00 +00:00
|
|
|
isStore100UniqueRelevant() {
|
|
|
|
return Object.keys(this.root.hubGoals.storedShapes).length < 100;
|
2021-03-01 23:07:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-03 16:59:56 +00:00
|
|
|
* @param {string} key
|
2021-03-01 23:07:21 +00:00
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isStore100UniqueValid(key) {
|
|
|
|
return Object.keys(this.root.hubGoals.storedShapes).length === 100;
|
2021-03-03 22:30:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} key
|
2021-03-04 16:41:00 +00:00
|
|
|
* @param {StorageComponent} storage
|
2021-03-03 22:30:14 +00:00
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2021-03-04 16:41:00 +00:00
|
|
|
isStoreShapeValid(key, storage) {
|
|
|
|
return storage.storedCount >= 1;
|
2021-03-03 22:30:14 +00:00
|
|
|
}
|
2021-03-01 23:07:21 +00:00
|
|
|
}
|