mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-22 20:22:51 +00:00
Add achievement count to offline progress modal, fixes #1948
This commit is contained in:
parent
96730c9af1
commit
bd7c3d94c0
@ -9,6 +9,9 @@ class AwayProgress {
|
||||
// This is an array of strings, each one the name of the next entry in the player object to navigate to
|
||||
// If there is no reference, it is accessed directly by the name through the player object.
|
||||
this.reference = config.reference === undefined ? [this.name] : config.reference;
|
||||
// Most of the entries in offline progress are props which can be directly read from the player object, but eg. for
|
||||
// achievements the raw data is an array of bitmasks. This structure allows generic support for indirect values.
|
||||
this.applyFn = config.applyFn === undefined ? x => x : config.applyFn;
|
||||
this.classObjectReference = config.classObjectReference === undefined ? this.name : config.classObjectReference;
|
||||
this.appearsInAwayModal = config.appearsInAwayModal === undefined ? true : config.appearsInAwayModal;
|
||||
}
|
||||
@ -41,7 +44,7 @@ class AwayProgress {
|
||||
for (const goTo of this.reference) {
|
||||
place = place[goTo];
|
||||
}
|
||||
return place;
|
||||
return this.applyFn(place);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,6 +103,12 @@ const AwayProgressTypes = {
|
||||
reference: ["dilation", "totalTachyonGalaxies"],
|
||||
isUnlocked: () => PlayerProgress.dilationUnlocked() || PlayerProgress.realityUnlocked(),
|
||||
}),
|
||||
achievements: new AwayProgress({
|
||||
name: "achievementCount",
|
||||
reference: ["achievementBits"],
|
||||
applyFn: x => x.map(b => countValuesFromBitmask(b)).sum(),
|
||||
isUnlocked: () => PlayerProgress.realityUnlocked(),
|
||||
}),
|
||||
realities: new AwayProgress({
|
||||
name: "realities",
|
||||
isUnlocked: () => PlayerProgress.realityUnlocked(),
|
||||
|
@ -113,7 +113,7 @@ function getSingleGlyphEffectFromBitmask(effectName, glyph) {
|
||||
return glyphEffect.effect(getAdjustedGlyphLevel(glyph), glyph.strength);
|
||||
}
|
||||
|
||||
// Note this function is used for both glyph bitmasks and news ticker bitmasks
|
||||
// Note this function is used for glyph bitmasks, news ticker bitmasks, and offline achievements
|
||||
function countValuesFromBitmask(bitmask) {
|
||||
let numEffects = 0;
|
||||
let bits = bitmask;
|
||||
|
@ -685,6 +685,7 @@ let player = {
|
||||
tachyonParticles: true,
|
||||
dilatedTime: true,
|
||||
tachyonGalaxies: true,
|
||||
achievementCount: true,
|
||||
realities: true,
|
||||
realityMachines: true,
|
||||
imaginaryMachines: true,
|
||||
|
@ -5163,6 +5163,7 @@ screen and (max-width: 480px) {
|
||||
}
|
||||
|
||||
.c-modal-away-progress__realities,
|
||||
.c-modal-away-progress__achievement-count,
|
||||
.c-modal-away-progress__reality-machines,
|
||||
.c-modal-away-progress__imaginary-machines {
|
||||
color: var(--color-reality);
|
||||
|
Loading…
Reference in New Issue
Block a user