Merge branch 'day-20-factory' of https://github.com/thepaperpilot/Advent-Incremental into day-20-factory

This commit is contained in:
ducdat0507 2022-12-22 19:07:44 +07:00
commit 18cc80c82b
2 changed files with 17 additions and 1 deletions

View file

@ -7,7 +7,7 @@ import Spacer from "components/layout/Spacer.vue";
import { jsx } from "features/feature";
import { globalBus } from "game/events";
import { createLayer } from "game/layers";
import { noPersist, Persistent, persistent, State } from "game/persistence";
import { noPersist, noPersist, Persistent, persistent, State } from "game/persistence";
import Decimal, { format, formatWhole } from "util/bignum";
import { Direction } from "util/common";
import { computed, ComputedRef, reactive, ref, watchEffect } from "vue";
@ -350,6 +350,18 @@ const factory = createLayer(id, () => {
return acc;
}, {} as Record<FactoryCompNames, GenericHotkey>);
const hotkeys = (Object.keys(FACTORY_COMPONENTS) as FactoryCompNames[]).reduce((acc, comp) => {
acc[comp] = createHotkey(() => ({
key: FACTORY_COMPONENTS[comp].key,
description: "Select " + FACTORY_COMPONENTS[comp].name,
onPress() {
compSelected.value = comp;
},
enabled: noPersist(main.days[day - 1].opened)
}));
return acc;
}, {} as Record<FactoryCompNames, GenericHotkey>);
type FactoryCompNames =
| "cursor"
| "delete"
@ -389,6 +401,7 @@ const factory = createLayer(id, () => {
interface FactoryComponentDeclaration {
tick: number;
key: string;
key: string;
imageSrc: string;
name: string;
type: "command" | "conveyor" | "processor";
@ -520,6 +533,7 @@ const factory = createLayer(id, () => {
loaded = true;
watchEffect(updateGraphics);
watchEffect(updateGraphics);
});
(window as any).internal = compInternalData;
(window as any).comp = components;
@ -836,6 +850,7 @@ const factory = createLayer(id, () => {
hoverSprite.width = blockSize;
hoverSprite.height = blockSize;
hoverSprite.alpha = 0.5;
hoverSprite.alpha = 0.5;
graphicContainer.addChild(hoverSprite);
}
}

View file

@ -24,6 +24,7 @@ import cloth from "./layers/cloth";
import coal from "./layers/coal";
import dyes from "./layers/dyes";
import elves from "./layers/elves";
import factory from "./layers/factory";
import letters from "./layers/letters";
import management from "./layers/management";
import metal from "./layers/metal";