mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2025-02-07 10:41:36 +00:00
maybe do stuff?
This commit is contained in:
parent
eb4a615979
commit
be4f0cef38
2 changed files with 57 additions and 3 deletions
|
@ -14,6 +14,8 @@ import { format } from "util/bignum";
|
||||||
import { createCollapsibleModifierSections, setUpDailyProgressTracker, createCollapsibleMilestones } from "data/common";
|
import { createCollapsibleModifierSections, setUpDailyProgressTracker, createCollapsibleMilestones } from "data/common";
|
||||||
import Modal from "components/Modal.vue";
|
import Modal from "components/Modal.vue";
|
||||||
import { createMilestone } from "features/milestones/milestone";
|
import { createMilestone } from "features/milestones/milestone";
|
||||||
|
import { createClickable } from "features/clickables/clickable";
|
||||||
|
import { main } from "../projEntry";
|
||||||
|
|
||||||
const id = "wrappingPaper";
|
const id = "wrappingPaper";
|
||||||
const day = 15;
|
const day = 15;
|
||||||
|
@ -347,6 +349,19 @@ const layer = createLayer (id, () => {
|
||||||
const { collapseMilestones, display: milestonesDisplay } =
|
const { collapseMilestones, display: milestonesDisplay } =
|
||||||
createCollapsibleMilestones(milestones);
|
createCollapsibleMilestones(milestones);
|
||||||
|
|
||||||
|
const enterMasteryButton = createClickable(() => ({
|
||||||
|
display: jsx(() => {
|
||||||
|
return (
|
||||||
|
<>{
|
||||||
|
main.isMastery.value ? "Leave Mastery" : "Enter Mastery"
|
||||||
|
}</>
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
onClick () {
|
||||||
|
main.toggleMastery();
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
|
@ -361,7 +376,7 @@ const layer = createLayer (id, () => {
|
||||||
{renderRow(wrappingPaper.sunshine.display, wrappingPaper.ocean.display, wrappingPaper.beach.display)}
|
{renderRow(wrappingPaper.sunshine.display, wrappingPaper.ocean.display, wrappingPaper.beach.display)}
|
||||||
{renderRow(wrappingPaper.sunshine.buyable, wrappingPaper.ocean.buyable, wrappingPaper.beach.buyable)}
|
{renderRow(wrappingPaper.sunshine.buyable, wrappingPaper.ocean.buyable, wrappingPaper.beach.buyable)}
|
||||||
<Spacer />
|
<Spacer />
|
||||||
button goes here
|
{render(enterMasteryButton)}
|
||||||
<Spacer />
|
<Spacer />
|
||||||
{milestonesDisplay()}
|
{milestonesDisplay()}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -44,6 +44,7 @@ import plastic from "./layers/plastic";
|
||||||
import dyes from "./layers/dyes";
|
import dyes from "./layers/dyes";
|
||||||
import management from "./layers/management";
|
import management from "./layers/management";
|
||||||
import wrappingPaper from "./layers/wrapping-paper";
|
import wrappingPaper from "./layers/wrapping-paper";
|
||||||
|
import { createReset } from "features/reset";
|
||||||
|
|
||||||
export interface Day extends VueFeature {
|
export interface Day extends VueFeature {
|
||||||
day: number;
|
day: number;
|
||||||
|
@ -56,6 +57,20 @@ export interface Day extends VueFeature {
|
||||||
shouldNotify: ProcessedComputable<boolean>;
|
shouldNotify: ProcessedComputable<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const masterableLayers = [
|
||||||
|
trees,
|
||||||
|
workshop,
|
||||||
|
coal,
|
||||||
|
elves,
|
||||||
|
paper,
|
||||||
|
boxes,
|
||||||
|
metal,
|
||||||
|
cloth,
|
||||||
|
oil,
|
||||||
|
plastic,
|
||||||
|
dyes
|
||||||
|
]
|
||||||
|
|
||||||
export const main = createLayer("main", function (this: BaseLayer) {
|
export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
const day = persistent<number>(1);
|
const day = persistent<number>(1);
|
||||||
const timeUntilNewDay = computed(
|
const timeUntilNewDay = computed(
|
||||||
|
@ -67,6 +82,25 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
const loreTitle = ref<string>("");
|
const loreTitle = ref<string>("");
|
||||||
const loreBody = ref<CoercableComponent | undefined>();
|
const loreBody = ref<CoercableComponent | undefined>();
|
||||||
|
|
||||||
|
const isMastery = persistent<boolean>(false);
|
||||||
|
const cachedSaves = persistent<Record<string, string>>({});
|
||||||
|
const toggleMastery = () => {
|
||||||
|
isMastery.value = !isMastery.value;
|
||||||
|
for (let layer of masterableLayers) {
|
||||||
|
const stringSave = JSON.stringify(layer, (key, value) => unref(value));
|
||||||
|
if (cachedSaves.value[layer.name]) {
|
||||||
|
Object.assign(layer, JSON.parse(cachedSaves.value[layer.name]));
|
||||||
|
} else {
|
||||||
|
// hacky but only occurs once, to create a new layer for mastery
|
||||||
|
const reset = createReset(() => ({
|
||||||
|
thingsToReset: [layer],
|
||||||
|
}));
|
||||||
|
reset.reset();
|
||||||
|
cachedSaves.value[layer.name] = stringSave;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createDay(
|
function createDay(
|
||||||
optionsFunc: () => {
|
optionsFunc: () => {
|
||||||
day: number;
|
day: number;
|
||||||
|
@ -79,6 +113,8 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
): Day {
|
): Day {
|
||||||
const opened = persistent<boolean>(false);
|
const opened = persistent<boolean>(false);
|
||||||
const recentlyUpdated = persistent<boolean>(false);
|
const recentlyUpdated = persistent<boolean>(false);
|
||||||
|
const cachedSaves = persistent<string[]>([]);
|
||||||
|
const getLayer = computed(() => player.layers[optionsFunc().layer ?? "trees"]) // Probably a better way to do this
|
||||||
|
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const day = optionsFunc();
|
const day = optionsFunc();
|
||||||
|
@ -103,7 +139,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
shouldNotify,
|
shouldNotify,
|
||||||
story,
|
story,
|
||||||
completedStory,
|
completedStory,
|
||||||
recentlyUpdated
|
recentlyUpdated,
|
||||||
} = this;
|
} = this;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -288,7 +324,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
createDay(() => ({
|
createDay(() => ({
|
||||||
day: 15,
|
day: 15,
|
||||||
shouldNotify: false,
|
shouldNotify: false,
|
||||||
layer: null, // "wrappingPaper"
|
layer: "wrappingPaper",
|
||||||
symbol: wrappingPaperSymbol,
|
symbol: wrappingPaperSymbol,
|
||||||
story: "You'll need to produce wrapping paper so the presents can be wrapped. The elves are getting a bit bored of their boring old workstations, so you decide to let them decorate with some wrapping paper.",
|
story: "You'll need to produce wrapping paper so the presents can be wrapped. The elves are getting a bit bored of their boring old workstations, so you decide to let them decorate with some wrapping paper.",
|
||||||
completedStory: "You've produced enough wrapping paper, and the elves are happy with their new workstations. However, some will need more than just wrapping paper to decorate."
|
completedStory: "You've produced enough wrapping paper, and the elves are happy with their new workstations. However, some will need more than just wrapping paper to decorate."
|
||||||
|
@ -388,6 +424,9 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
showLoreModal,
|
showLoreModal,
|
||||||
completeDay,
|
completeDay,
|
||||||
minWidth: 700,
|
minWidth: 700,
|
||||||
|
isMastery,
|
||||||
|
toggleMastery,
|
||||||
|
|
||||||
display: jsx(() => (
|
display: jsx(() => (
|
||||||
<>
|
<>
|
||||||
{player.devSpeed === 0 ? <div>Game Paused</div> : null}
|
{player.devSpeed === 0 ? <div>Game Paused</div> : null}
|
||||||
|
|
Loading…
Add table
Reference in a new issue