Added dev speed, offline time, and points/s to default main tab

This commit is contained in:
thepaperpilot 2021-06-14 09:04:08 -05:00
parent 38e85dec2c
commit af0c4373a3
3 changed files with 92 additions and 48 deletions

View file

@ -73,7 +73,7 @@ export default {
.side-nodes { .side-nodes {
position: absolute; position: absolute;
right: 55px; right: 15px;
top: 65px; top: 65px;
} }
</style> </style>

View file

@ -38,9 +38,21 @@ const spook = {
const main = { const main = {
id: 'main', id: 'main',
display: '<tree :append="true" />', display: `<div v-frag>
<div v-if="player.devSpeed && player.devSpeed !== 1">Dev Speed: {{ format(player.devSpeed) }}x</div>
<div v-if="player.offTime != undefined">Offline Time: {{ formatTime(player.offTime.remain) }}</div>
<div>
<span v-if="player.points.lt('1e1000')">You have </span>
<h2>{{ format(player.points) }}</h2>
<span v-if="player.points.lt('1e1e6')"> points</span>
</div>
<div v-if="Decimal.gt($store.getters.pointGain, 0)">
({{ player.oompsMag != 0 ? format(player.oomps) + " OOM" + (player.oompsMag < 0 ? "^OOM" : player.oompsMag > 1 ? "^" + player.oompsMag : "") + "s" : formatSmall($store.getters.pointGain) }}/sec)
</div>
<tree :append="true" />
</div>`,
name: "Tree" name: "Tree"
} };
export const initialLayers = [ main, f, c, a, g, h, spook ]; export const initialLayers = [ main, f, c, a, g, h, spook ];
@ -52,7 +64,7 @@ export function getStartingData() {
export const getters = { export const getters = {
hasWon() { hasWon() {
return false return false;
}, },
pointGain() { pointGain() {
if(!hasUpgrade("c", 11)) if(!hasUpgrade("c", 11))

View file

@ -13,6 +13,80 @@ function updateParticles(/* diff */) {
// TODO // TODO
} }
function updateOOMPS(diff) {
if (player.points != undefined) {
player.oompsMag = 0;
if (player.points.lte(new Decimal(1e100))) {
return;
}
let curr = new Decimal(player.points);
let prev = player.lastPoints || new Decimal(0);
if (curr.gt(prev)) {
if (curr.gte("10^^8")) {
curr = curr.slog(1e10);
prev = prev.slog(1e10);
player.oomps = curr.sub(prev).div(diff);
player.oompsMag = -1;
} else {
while (curr.div(prev).log(10).div(diff).gte("100") && player.oompsMag <= 5 && prev.gt(0)) {
curr = curr.log(10);
prev = prev.log(10);
player.oomps = curr.sub(prev).div(diff);
player.oompsMag++;
}
}
}
}
}
function updateLayers(diff) {
// Update each active layer
const activeLayers = Object.keys(layers).filter(layer => !layers[layer].deactivated);
activeLayers.forEach(layer => {
if (player[layer].resetTime != undefined) {
player[layer].resetTime = player[layer].resetTime.add(diff);
}
if (layers[layer].passiveGeneration) {
player[layer].points =
player[layer].points.add(Decimal.times(layers[layer].resetGain, layers[layer].passiveGeneration).times(diff));
}
layers[layer].update?.(diff);
});
// Automate each active layer
activeLayers.forEach(layer => {
if (layers[layer].autoReset && layers[layer].canReset) {
layers[layer].reset();
}
layers[layer].automate?.();
if (layers[layer].upgrades && layers[layer].autoUpgrade) {
Object.values(layers[layer].upgrades).forEach(upgrade => upgrade.buy());
}
});
// Check each active layer for newly unlocked achievements or milestones
activeLayers.forEach(layer => {
if (layers[layer].milestones) {
Object.values(layers[layer].milestones).forEach(milestone => {
if (milestone.unlocked !== false && !milestone.earned && milestone.done) {
player[layer].milestones.push(milestone.id);
milestone.onComplete?.();
// TODO popup notification
player[layer].lastMilestone = milestone.id;
}
});
}
if (layers[layer].achievements) {
Object.values(layers[layer].achievements).forEach(achievement => {
if (achievement.unlocked !== false && !achievement.earned && achievement.done) {
player[layer].achievements.push(achievement.id);
achievement.onComplete?.();
// TODO popup notification
}
});
}
});
}
function update() { function update() {
let now = Date.now(); let now = Date.now();
let diff = (now - player.time) / 1e3; let diff = (now - player.time) / 1e3;
@ -66,50 +140,8 @@ function update() {
player.points = player.points.add(Decimal.times(store.getters.pointGain, diff)); player.points = player.points.add(Decimal.times(store.getters.pointGain, diff));
} }
modUpdate(diff); modUpdate(diff);
// Update each active layer updateOOMPS(trueDiff);
const activeLayers = Object.keys(layers).filter(layer => !layers[layer].deactivated); updateLayers(diff);
activeLayers.forEach(layer => {
if (player[layer].resetTime != undefined) {
player[layer].resetTime = player[layer].resetTime.add(diff);
}
if (layers[layer].passiveGeneration) {
player[layer].points =
player[layer].points.add(Decimal.times(layers[layer].resetGain, layers[layer].passiveGeneration).times(diff));
}
layers[layer].update?.(diff);
});
// Automate each active layer
activeLayers.forEach(layer => {
if (layers[layer].autoReset && layers[layer].canReset) {
layers[layer].reset();
}
layers[layer].automate?.();
if (layers[layer].upgrades && layers[layer].autoUpgrade) {
Object.values(layers[layer].upgrades).forEach(upgrade => upgrade.buy());
}
});
// Check each active layer for newly unlocked achievements or milestones
activeLayers.forEach(layer => {
if (layers[layer].milestones) {
Object.values(layers[layer].milestones).forEach(milestone => {
if (milestone.unlocked !== false && !milestone.earned && milestone.done) {
player[layer].milestones.push(milestone.id);
milestone.onComplete?.();
// TODO popup notification
player[layer].lastMilestone = milestone.id;
}
});
}
if (layers[layer].achievements) {
Object.values(layers[layer].achievements).forEach(achievement => {
if (achievement.unlocked !== false && !achievement.earned && achievement.done) {
player[layer].achievements.push(achievement.id);
achievement.onComplete?.();
// TODO popup notification
}
});
}
});
} }
export function startGameLoop() { export function startGameLoop() {