From 2c5bfdb7f389ac70047db9ba9b122e44ec22c71c Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Thu, 22 Dec 2022 16:01:19 -0600 Subject: [PATCH] Added new toys and progress stuff --- src/data/layers/factory.tsx | 312 ++++++++++++++++++++++++++++- src/data/layers/styles/factory.css | 3 + 2 files changed, 310 insertions(+), 5 deletions(-) diff --git a/src/data/layers/factory.tsx b/src/data/layers/factory.tsx index 7f0f53d..530ea04 100644 --- a/src/data/layers/factory.tsx +++ b/src/data/layers/factory.tsx @@ -31,9 +31,29 @@ import { Direction } from "util/common"; import { ProcessedComputable } from "util/computed"; import { render, renderRow } from "util/vue"; import { computed, ComputedRef, reactive, ref, unref, watchEffect } from "vue"; +import _cloth from "../symbols/cloth.png"; +import _dye from "../symbols/dyes.png"; +import _metal from "../symbols/metal.png"; +import _plastic from "../symbols/plastic.png"; import coal from "./coal"; +import { + default as _bear, + default as _circuitBoard, + default as _console, + default as _stuffing +} from "./factory-components/bear.svg"; +import { + default as _bearMaker, + default as _circuitBoardMaker, + default as _consoleMaker, + default as _stuffingMaker +} from "./factory-components/bearmaker.svg"; import _block from "./factory-components/block.svg"; import _blockMaker from "./factory-components/blockmaker.svg"; +import _bucket from "./factory-components/bucket.svg"; +import _bucketMaker from "./factory-components/bucketmaker.svg"; +import _bucketShovel from "./factory-components/bucketShovel.svg"; +import _bucketShovelMaker from "./factory-components/bucketShovelmaker.svg"; import _clothes from "./factory-components/clothes.svg"; import _clothesMaker from "./factory-components/clothesmaker.svg"; import _conveyor from "./factory-components/conveyor.png"; @@ -45,10 +65,11 @@ import _rotateLeft from "./factory-components/rotateLeft.svg"; import _rotateRight from "./factory-components/rotateRight.svg"; import _plankMaker from "./factory-components/sawmill.svg"; import _shed from "./factory-components/shed.svg"; -import _metal from "../symbols/metal.png"; -import _plastic from "../symbols/plastic.png"; -import _cloth from "../symbols/cloth.png"; -import _dye from "../symbols/dyes.png"; +import { default as _button, default as _shovel } from "./factory-components/shovel.svg"; +import { + default as _buttonMaker, + default as _shovelMaker +} from "./factory-components/shovelmaker.svg"; import _thread from "./factory-components/thread.svg"; import _threadMaker from "./factory-components/threadmaker.svg"; import _truck from "./factory-components/truck.svg"; @@ -62,10 +83,12 @@ import toys from "./toys"; const id = "factory"; -// what is the actual day? const day = 18; +const advancedDay = 19; +const presentsDay = 20; const toyGoal = 750; +const advancedToyGoal = 2000; // 20x20 block size // TODO: unhardcode stuff @@ -114,6 +137,10 @@ const factory = createLayer(id, () => { const name = "The Factory"; const color = "grey"; + const bears = createResource(0, "teddy bears"); + const bucketAndShovels = createResource(0, "shovel and pails"); + const consoles = createResource(0, "consoles"); + const energy = createSequentialModifier(() => [ createAdditiveModifier(() => ({ addend: () => Decimal.add(1, coal.coal.value).log10(), @@ -402,6 +429,109 @@ const factory = createLayer(id, () => { } } } as FactoryComponentDeclaration, + button: { + imageSrc: _buttonMaker, + key: "shift+4", + name: "Button Maker", + type: "processor", + description: "Turns 1 plastic into 2 buttons every second.", + energyCost: 2, + tick: 1, + inputs: { + plastic: { + amount: 1 + } + }, + outputs: { + buttons: { + amount: 2 + } + }, + visible: main.days[advancedDay - 1].opened + } as FactoryComponentDeclaration, + stuffing: { + imageSrc: _stuffingMaker, + key: "shift+5", + name: "Cloth Shredder", + type: "processor", + description: "Turns 1 cloth into 1 stuffing every second.", + energyCost: 2, + tick: 1, + inputs: { + cloth: { + amount: 1 + } + }, + outputs: { + stuffing: { + amount: 1 + } + }, + visible: main.days[advancedDay - 1].opened + } as FactoryComponentDeclaration, + shovel: { + imageSrc: _shovelMaker, + key: "shift+6", + name: "Shovel Maker", + type: "processor", + description: "Turns 2 plastic into 1 shovel every second.", + energyCost: 2, + tick: 1, + inputs: { + plastic: { + amount: 2 + } + }, + outputs: { + shovel: { + amount: 1 + } + }, + visible: main.days[advancedDay - 1].opened + } as FactoryComponentDeclaration, + bucket: { + imageSrc: _bucketMaker, + key: "shift+7", + name: "Bucket Maker", + type: "processor", + description: "Turns 3 plastic into 1 bucket every second.", + energyCost: 2, + tick: 1, + inputs: { + plastic: { + amount: 3 + } + }, + outputs: { + shovel: { + amount: 1 + } + }, + visible: main.days[advancedDay - 1].opened + } as FactoryComponentDeclaration, + circuitBoard: { + imageSrc: _circuitBoardMaker, + key: "shift+8", + name: "Circuit Board Manufacturer", + type: "processor", + description: "Turns 1 metal and 1 plastic into 1 circuit board every second.", + energyCost: 2, + tick: 1, + inputs: { + metal: { + amount: 1 + }, + plastic: { + amount: 1 + } + }, + outputs: { + circuitBoard: { + amount: 1 + } + }, + visible: main.days[advancedDay - 1].opened + } as FactoryComponentDeclaration, blocks: { imageSrc: _blockMaker, key: "ctrl+shift+1", @@ -470,6 +600,89 @@ const factory = createLayer(id, () => { resource: toys.trucks } } + } as FactoryComponentDeclaration, + bear: { + imageSrc: _bearMaker, + key: "ctrl+shift+4", + name: "Teddy Bear Maker", + type: "processor", + description: + "Turns 1 thread, 1 stuffing, 1 dye, and 3 buttons into 1 teddy bear every second.", + energyCost: 20, + tick: 1, + inputs: { + thread: { + amount: 1 + }, + stuffing: { + amount: 1 + }, + dye: { + amount: 1 + }, + buttons: { + amount: 3 + } + }, + outputs: { + bear: { + amount: 1, + resource: bears + } + }, + visible: main.days[advancedDay - 1].opened + } as FactoryComponentDeclaration, + bucketShovel: { + imageSrc: _bucketShovelMaker, + key: "ctrl+shift+5", + name: "Shovel and Pail Maker", + type: "processor", + description: "Turns 1 bucket and 1 shovel into 1 shovel and pail every second.", + energyCost: 20, + tick: 1, + inputs: { + bucket: { + amount: 1 + }, + shovel: { + amount: 1 + } + }, + outputs: { + shovelBucket: { + amount: 1, + resource: bucketAndShovels + } + }, + visible: main.days[advancedDay - 1].opened + } as FactoryComponentDeclaration, + console: { + imageSrc: _consoleMaker, + key: "ctrl+shift+6", + name: "Game Console Maker", + type: "processor", + description: + "Turns 1 metal, 3 plastic, and 1 circuit board into 1 game console every second.", + energyCost: 20, + tick: 1, + inputs: { + metal: { + amount: 1 + }, + plastic: { + amount: 3 + }, + circuitBoard: { + amount: 1 + } + }, + outputs: { + console: { + amount: 1, + resource: consoles + } + }, + visible: main.days[advancedDay - 1].opened } as FactoryComponentDeclaration } as const; const RESOURCES = { @@ -507,6 +720,26 @@ const factory = createLayer(id, () => { name: "Wheels", imageSrc: _wheel }, + buttons: { + name: "Buttons", + imageSrc: _button + }, + stuffing: { + name: "Stuffing", + imageSrc: _stuffing + }, + shovel: { + name: "Shovel", + imageSrc: _shovel + }, + bucket: { + name: "Bucket", + imageSrc: _bucket + }, + circuitBoard: { + name: "Circuit Board", + imageSrc: _circuitBoard + }, // Toys block: { name: "Wooden Blocks", @@ -519,6 +752,18 @@ const factory = createLayer(id, () => { trucks: { name: "Trucks", imageSrc: _truck + }, + bear: { + name: "Teddy Bear", + imageSrc: _bear + }, + shovelBucket: { + name: "Shovel and Pail", + imageSrc: _bucketShovel + }, + console: { + name: "Game Console", + imageSrc: _console } } as const; @@ -578,6 +823,7 @@ const factory = createLayer(id, () => { type: "command" | "conveyor" | "processor"; description: ProcessedComputable; energyCost?: number; + visible?: ProcessedComputable; /** amount it consumes */ inputs?: Stock; @@ -1264,6 +1510,9 @@ const factory = createLayer(id, () => { {Object.entries(FACTORY_COMPONENTS).map(value => { const key = value[0] as FactoryCompNames; const item = value[1]; + if (unref(item.visible) === false) { + return null; + } return (
{
{main.day.value === day ? `Reach ${format(toyGoal)} for each toy to complete the day` + : main.day.value === advancedDay + ? `Reach ${format( + advancedToyGoal + )} for each toy to complete the day` : `${name} Complete!`}{" "} -{" "}