1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

[WIP] Add more achievements

This commit is contained in:
Greg Considine 2021-03-04 16:16:18 -05:00
parent 311a620527
commit dc2ae5504c
3 changed files with 38 additions and 0 deletions

View File

@ -252,6 +252,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
}
this.shapeKeyToDefinition[id] = definition;
this.root.signals.achievementUnlocked.dispatch(ACHIEVEMENTS.oldLevel17, definition);
this.root.signals.achievementUnlocked.dispatch(ACHIEVEMENTS.produceLogo, definition);
this.root.signals.achievementUnlocked.dispatch(ACHIEVEMENTS.produceMsLogo, definition);
this.root.signals.achievementUnlocked.dispatch(ACHIEVEMENTS.produceRocket, definition);

View File

@ -13,8 +13,11 @@ export const ACHIEVEMENTS = {
completeLvl26: "completeLvl26",
cutShape: "cutShape",
darkMode: "darkMode",
irrelevantShape: "irrelevantShape",
level100: "level100",
level50: "level50",
oldLevel17: "oldLevel17",
openWires: "openWires",
paintShape: "paintShape",
place5000Wires: "place5000Wires",
placeBlueprint: "placeBlueprint",
@ -33,6 +36,7 @@ export const ACHIEVEMENTS = {
};
const DARK_MODE = "dark";
const WIRE_LAYER = "wires";
const HOUR_1 = 3600; // Seconds
const HOUR_10 = HOUR_1 * 10;
const HOUR_20 = HOUR_1 * 20;
@ -40,6 +44,7 @@ const SHAPE_BLUEPRINT = "CbCbCbRb:CwCwCwCw";
const SHAPE_LOGO = "RuCw--Cw:----Ru--";
const SHAPE_MS_LOGO = "RgRyRbRr";
const SHAPE_ROCKET = "CbCuCbCu:Sr------:--CrSrCr:CwCwCwCw";
const SHAPE_OLD_LEVEL_17 = "WrRgWrRg:CwCrCwCr:SgSgSgSg";
export class AchievementProviderInterface {
/** @param {Application} app */
@ -144,8 +149,19 @@ export class AchievementCollection {
this.createAndSet(ACHIEVEMENTS.darkMode, {
isValid: this.isDarkModeValid,
});
/*
*this.createAndSet(ACHIEVEMENTS.irrelevantShape, {
* isValid: this.isIrrelevantShapeValid,
* signal: "shapeDelivered",
*});
*/
this.createAndSet(ACHIEVEMENTS.level100, this.createLevelOptions(100));
this.createAndSet(ACHIEVEMENTS.level50, this.createLevelOptions(50));
this.createAndSet(ACHIEVEMENTS.oldLevel17, this.createShapeOptions(SHAPE_OLD_LEVEL_17));
this.createAndSet(ACHIEVEMENTS.openWires, {
isValid: this.isOpenWiresValid,
signal: "editModeChanged",
});
this.createAndSet(ACHIEVEMENTS.paintShape);
this.createAndSet(ACHIEVEMENTS.place5000Wires, {
isValid: this.isPlace5000WiresValid,
@ -346,6 +362,24 @@ export class AchievementCollection {
return this.root.app.settings.currentData.settings.theme === DARK_MODE;
}
/**
* @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;
}
/**
* @param {string} key
* @param {Entity} entity

View File

@ -16,8 +16,11 @@ const ACHIEVEMENT_IDS = {
[ACHIEVEMENTS.completeLvl26]: "complete_lvl_26",
[ACHIEVEMENTS.cutShape]: "cut_shape",
[ACHIEVEMENTS.darkMode]: "dark_mode",
[ACHIEVEMENTS.irrelevantShape]: "irrelevant_shape",
[ACHIEVEMENTS.level100]: "level_100",
[ACHIEVEMENTS.level50]: "level_50",
[ACHIEVEMENTS.openWires]: "open_wires",
[ACHIEVEMENTS.oldLevel17]: "old_level_17",
[ACHIEVEMENTS.paintShape]: "paint_shape",
[ACHIEVEMENTS.place5000Wires]: "place_5000_wires",
[ACHIEVEMENTS.placeBlueprint]: "place_blueprint",