This commit is contained in:
thepaperpilot 2024-12-12 07:39:10 -06:00
parent ff14443102
commit 7f2fa9cc27
7 changed files with 16 additions and 19 deletions

View file

@ -14,7 +14,6 @@ import {
setupDraggableNode, setupDraggableNode,
setupUniqueIds setupUniqueIds
} from "game/boards/board"; } from "game/boards/board";
import type { BaseLayer } from "game/layers";
import { createLayer } from "game/layers"; import { createLayer } from "game/layers";
import { persistent } from "game/persistence"; import { persistent } from "game/persistence";
import { createCostRequirement } from "game/requirements"; import { createCostRequirement } from "game/requirements";
@ -22,7 +21,7 @@ import { render } from "util/vue";
import { ComponentPublicInstance, computed, ref, watch } from "vue"; import { ComponentPublicInstance, computed, ref, watch } from "vue";
import { setupSelectable } from "../common"; import { setupSelectable } from "../common";
const board = createLayer("board", function (this: BaseLayer) { const board = createLayer("board", () => {
type ANode = NodePosition & { id: number; links: number[]; type: "anode"; z: number }; type ANode = NodePosition & { id: number; links: number[]; type: "anode"; z: number };
type BNode = NodePosition & { id: number; links: number[]; type: "bnode"; z: number }; type BNode = NodePosition & { id: number; links: number[]; type: "bnode"; z: number };
type CNode = typeof cNode & { draggable: Draggable<number | "cNode"> }; type CNode = typeof cNode & { draggable: Draggable<number | "cNode"> };

View file

@ -3,9 +3,9 @@ import Profectus from "components/Profectus.vue";
import Spacer from "components/layout/Spacer.vue"; import Spacer from "components/layout/Spacer.vue";
import { createResource, trackBest, trackOOMPS, trackTotal } from "features/resources/resource"; import { createResource, trackBest, trackOOMPS, trackTotal } from "features/resources/resource";
import { branchedResetPropagation, createTree, Tree } from "features/trees/tree"; import { branchedResetPropagation, createTree, Tree } from "features/trees/tree";
import { globalBus } from "game/events"; import type { Layer } from "game/layers";
import type { BaseLayer, Layer } from "game/layers";
import { createLayer, setupLayerModal } from "game/layers"; import { createLayer, setupLayerModal } from "game/layers";
import { noPersist } from "game/persistence";
import player, { Player } from "game/player"; import player, { Player } from "game/player";
import type { DecimalSource } from "util/bignum"; import type { DecimalSource } from "util/bignum";
import Decimal, { format, formatTime } from "util/bignum"; import Decimal, { format, formatTime } from "util/bignum";
@ -15,12 +15,11 @@ import a from "./layers/aca/a";
import c from "./layers/aca/c"; import c from "./layers/aca/c";
import f from "./layers/aca/f"; import f from "./layers/aca/f";
import board from "./layers/board"; import board from "./layers/board";
import { noPersist } from "game/persistence";
/** /**
* @hidden * @hidden
*/ */
export const main = createLayer("main", function (this: BaseLayer) { export const main = createLayer("main", layer => {
const points = createResource<DecimalSource>(10); const points = createResource<DecimalSource>(10);
const best = trackBest(points); const best = trackBest(points);
const total = trackTotal(points); const total = trackTotal(points);
@ -32,7 +31,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
gain = gain.times(c.lollipopMultiplierEffect.value); gain = gain.times(c.lollipopMultiplierEffect.value);
return gain; return gain;
}); });
globalBus.on("update", diff => { layer.on("update", diff => {
points.value = Decimal.add(points.value, Decimal.times(pointGain.value, diff)); points.value = Decimal.add(points.value, Decimal.times(pointGain.value, diff));
}); });
const oomps = trackOOMPS(points, pointGain); const oomps = trackOOMPS(points, pointGain);

View file

@ -50,8 +50,7 @@ export interface AchievementOptions extends VueFeatureOptions {
requirements?: Requirements; requirements?: Requirements;
/** The display to use for this achievement. */ /** The display to use for this achievement. */
display?: display?:
| Renderable | MaybeGetter<Renderable>
| (() => Renderable)
| { | {
/** Description of the requirement(s) for this achievement. If unspecified then the requirements will be displayed automatically based on {@link requirements}. */ /** Description of the requirement(s) for this achievement. If unspecified then the requirements will be displayed automatically based on {@link requirements}. */
requirement?: MaybeGetter<Renderable>; requirement?: MaybeGetter<Renderable>;

View file

@ -39,8 +39,7 @@ export interface ChallengeOptions extends VueFeatureOptions {
completionLimit?: MaybeRefOrGetter<DecimalSource>; completionLimit?: MaybeRefOrGetter<DecimalSource>;
/** The display to use for this challenge. */ /** The display to use for this challenge. */
display?: display?:
| Renderable | MaybeGetter<Renderable>
| (() => Renderable)
| { | {
/** A header to appear at the top of the display. */ /** A header to appear at the top of the display. */
title?: MaybeGetter<Renderable>; title?: MaybeGetter<Renderable>;

View file

@ -24,8 +24,7 @@ export interface ClickableOptions extends VueFeatureOptions {
canClick?: MaybeRefOrGetter<boolean>; canClick?: MaybeRefOrGetter<boolean>;
/** The display to use for this clickable. */ /** The display to use for this clickable. */
display?: display?:
| Renderable | MaybeGetter<Renderable>
| (() => Renderable)
| { | {
/** A header to appear at the top of the display. */ /** A header to appear at the top of the display. */
title?: MaybeGetter<Renderable>; title?: MaybeGetter<Renderable>;
@ -67,10 +66,14 @@ export function createClickable<T extends ClickableOptions>(optionsFunc?: () =>
<span> <span>
{_display.title != null ? ( {_display.title != null ? (
<div> <div>
{render(_display.title, el => <h3>{el}</h3>)} {render(_display.title, el => (
<h3>{el}</h3>
))}
</div> </div>
) : null} ) : null}
{render(_display.description, el => <div>{el}</div>)} {render(_display.description, el => (
<div>{el}</div>
))}
</span> </span>
); );
} else if (_display != null) { } else if (_display != null) {

View file

@ -31,8 +31,7 @@ export interface RepeatableOptions extends ClickableOptions {
initialAmount?: DecimalSource; initialAmount?: DecimalSource;
/** The display to use for this repeatable. */ /** The display to use for this repeatable. */
display?: display?:
| Renderable | MaybeGetter<Renderable>
| (() => Renderable)
| { | {
/** A header to appear at the top of the display. */ /** A header to appear at the top of the display. */
title?: MaybeGetter<Renderable>; title?: MaybeGetter<Renderable>;

View file

@ -34,8 +34,7 @@ export const UpgradeType = Symbol("Upgrade");
export interface UpgradeOptions extends VueFeatureOptions, ClickableOptions { export interface UpgradeOptions extends VueFeatureOptions, ClickableOptions {
/** The display to use for this upgrade. */ /** The display to use for this upgrade. */
display?: display?:
| Renderable | MaybeGetter<Renderable>
| (() => Renderable)
| { | {
/** A header to appear at the top of the display. */ /** A header to appear at the top of the display. */
title?: MaybeGetter<Renderable>; title?: MaybeGetter<Renderable>;