From 2aa68be8521eb73628ece96e125c4c0f06fb89c5 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Thu, 22 Dec 2022 17:58:22 -0600 Subject: [PATCH] Basic reindeer stuff --- src/data/layers/reindeer.tsx | 83 ++++++++++++++++++++++++++++++++++++ src/data/projEntry.tsx | 7 +-- 2 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/data/layers/reindeer.tsx diff --git a/src/data/layers/reindeer.tsx b/src/data/layers/reindeer.tsx new file mode 100644 index 0000000..3a3f448 --- /dev/null +++ b/src/data/layers/reindeer.tsx @@ -0,0 +1,83 @@ +/** + * @module + * @hidden + */ +import Spacer from "components/layout/Spacer.vue"; +import Modal from "components/Modal.vue"; +import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; +import { main } from "data/projEntry"; +import { jsx } from "features/feature"; +import MainDisplay from "features/resources/MainDisplay.vue"; +import { createResource } from "features/resources/resource"; +import { globalBus } from "game/events"; +import { BaseLayer, createLayer } from "game/layers"; +import Decimal, { DecimalSource, format } from "util/bignum"; +import { render } from "util/vue"; +import { ref } from "vue"; + +const id = "reindeer"; +const day = 21; +const layer = createLayer(id, function (this: BaseLayer) { + const name = "Reindeer"; + const color = "brown"; + + const food = createResource(0, "reindeer food"); + + const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => []); + const showModifiersModal = ref(false); + const modifiersModal = jsx(() => ( + (showModifiersModal.value = value)} + v-slots={{ + header: () =>

{name} Modifiers

, + body: generalTab + }} + /> + )); + + globalBus.on("update", diff => { + if (Decimal.lt(main.day.value, day)) { + return; + } + }); + + const { total: totalFood, trackerDisplay } = setUpDailyProgressTracker({ + resource: food, + goal: 1e3, + name, + day, + background: color, + modal: { + show: showModifiersModal, + display: modifiersModal + } + }); + + return { + name, + day, + color, + food, + totalFood, + generalTabCollapsed, + minWidth: 700, + display: jsx(() => ( + <> + {render(trackerDisplay)} + + + + )), + minimizedDisplay: jsx(() => ( +
+ {name}{" "} + + {format(food.value)} {food.displayName} + +
+ )) + }; +}); + +export default layer; diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 97ffcd9..c036c3d 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -473,10 +473,11 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 21, shouldNotify: false, - layer: null, // "reindeer" + layer: "reindeer", symbol: "", - story: "", - completedStory: "", + story: "Now that the toys are being taken care of, it's time to make sure everything is prepped for the big night. One immediate concern is the reindeer, who are going to have to be in tip-top shape. Fortunately, Santa has a recipe to a very strong vitamin-filled kibble that'll get them pumped in no time!", + completedStory: + "Alright, now that the reindeer have been given all their ste- vitamins, I mean, they should be prepared for Christmas. Good Job!", masteredStory: "" })), createDay(() => ({