mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-24 09:21:48 +00:00
stuff
This commit is contained in:
parent
5cf9f4571f
commit
529eabbcd0
1 changed files with 90 additions and 347 deletions
|
@ -33,51 +33,29 @@ import { Direction, WithRequired } from "util/common";
|
||||||
import { ProcessedComputable } from "util/computed";
|
import { ProcessedComputable } from "util/computed";
|
||||||
import { render, renderGrid, renderRow, VueFeature } from "util/vue";
|
import { render, renderGrid, renderRow, VueFeature } from "util/vue";
|
||||||
import { computed, ComputedRef, reactive, ref, shallowRef, unref, watchEffect } from "vue";
|
import { computed, ComputedRef, reactive, ref, shallowRef, unref, watchEffect } from "vue";
|
||||||
import boxes from "./boxes";
|
|
||||||
import coal from "./coal";
|
|
||||||
import dyes from "./dyes";
|
|
||||||
import Factory from "./Factory.vue";
|
|
||||||
import metal from "./metal";
|
|
||||||
import oil from "./oil";
|
|
||||||
import paper from "./paper";
|
|
||||||
import plastic from "./plastic";
|
|
||||||
import "./styles/factory.css";
|
|
||||||
import Toy from "./Toy.vue";
|
|
||||||
import toys from "./toys";
|
|
||||||
import trees from "./trees";
|
|
||||||
import workshop from "./workshop";
|
|
||||||
|
|
||||||
import _cloth from "../symbols/cloth.png";
|
import _cloth from "../symbols/cloth.png";
|
||||||
import _dye from "../symbols/dyes.png";
|
import _dye from "../symbols/dyes.png";
|
||||||
import _metal from "../symbols/metal.png";
|
import _metal from "../symbols/metal.png";
|
||||||
import _plastic from "../symbols/plastic.png";
|
import _plastic from "../symbols/plastic.png";
|
||||||
import _boxes from "../symbols/cardboardBox.png";
|
import boxes from "./boxes";
|
||||||
import _wrappingPaper from "../symbols/wrappingPaper.png";
|
import coal from "./coal";
|
||||||
import _ribbon from "../symbols/ribbons.png";
|
import dyes from "./dyes";
|
||||||
|
|
||||||
import _bear from "./factory-components/bear.svg";
|
import _bear from "./factory-components/bear.svg";
|
||||||
import _bearMaker from "./factory-components/bearmaker.svg";
|
import _bearMaker from "./factory-components/bearmaker.svg";
|
||||||
import _bearWrapper from "./factory-components/__placeholder.png";
|
|
||||||
import _block from "./factory-components/block.svg";
|
import _block from "./factory-components/block.svg";
|
||||||
import _blockMaker from "./factory-components/blockmaker.svg";
|
import _blockMaker from "./factory-components/blockmaker.svg";
|
||||||
import _blockWrapper from "./factory-components/__placeholder.png";
|
|
||||||
import _bow from "./factory-components/__placeholder.png";
|
|
||||||
import _bowMaker from "./factory-components/__placeholder.png";
|
|
||||||
import _bucket from "./factory-components/bucket.svg";
|
import _bucket from "./factory-components/bucket.svg";
|
||||||
import _bucketMaker from "./factory-components/bucketmaker.svg";
|
import _bucketMaker from "./factory-components/bucketmaker.svg";
|
||||||
import _bucketShovel from "./factory-components/bucketshovel.svg";
|
import _bucketShovel from "./factory-components/bucketshovel.svg";
|
||||||
import _bucketShovelMaker from "./factory-components/bucketshovelmaker.svg";
|
import _bucketShovelMaker from "./factory-components/bucketshovelmaker.svg";
|
||||||
import _bucketShovelWrapper from "./factory-components/__placeholder.png";
|
|
||||||
import _button from "./factory-components/button.svg";
|
import _button from "./factory-components/button.svg";
|
||||||
import _buttonMaker from "./factory-components/buttonmaker.svg";
|
import _buttonMaker from "./factory-components/buttonmaker.svg";
|
||||||
import _circuitBoard from "./factory-components/circuit.svg";
|
import _circuitBoard from "./factory-components/circuit.svg";
|
||||||
import _circuitBoardMaker from "./factory-components/circuitmaker.svg";
|
import _circuitBoardMaker from "./factory-components/circuitmaker.svg";
|
||||||
import _clothes from "./factory-components/clothes.svg";
|
import _clothes from "./factory-components/clothes.svg";
|
||||||
import _clothesMaker from "./factory-components/clothesmaker.svg";
|
import _clothesMaker from "./factory-components/clothesmaker.svg";
|
||||||
import _clothesWrapper from "./factory-components/__placeholder.png";
|
|
||||||
import _console from "./factory-components/console.svg";
|
import _console from "./factory-components/console.svg";
|
||||||
import _consoleMaker from "./factory-components/consolemaker.svg";
|
import _consoleMaker from "./factory-components/consolemaker.svg";
|
||||||
import _consoleWrapper from "./factory-components/__placeholder.png";
|
|
||||||
import _conveyor from "./factory-components/conveyor.png";
|
import _conveyor from "./factory-components/conveyor.png";
|
||||||
import _cursor from "./factory-components/cursor.svg";
|
import _cursor from "./factory-components/cursor.svg";
|
||||||
import _delete from "./factory-components/delete.svg";
|
import _delete from "./factory-components/delete.svg";
|
||||||
|
@ -95,11 +73,18 @@ import _thread from "./factory-components/thread.svg";
|
||||||
import _threadMaker from "./factory-components/threadmaker.svg";
|
import _threadMaker from "./factory-components/threadmaker.svg";
|
||||||
import _truck from "./factory-components/truck.svg";
|
import _truck from "./factory-components/truck.svg";
|
||||||
import _truckMaker from "./factory-components/truckmaker.svg";
|
import _truckMaker from "./factory-components/truckmaker.svg";
|
||||||
import _truckWrapper from "./factory-components/__placeholder.png";
|
|
||||||
import _wheel from "./factory-components/wheel.svg";
|
import _wheel from "./factory-components/wheel.svg";
|
||||||
import _wheelMaker from "./factory-components/wheelmaker.svg";
|
import _wheelMaker from "./factory-components/wheelmaker.svg";
|
||||||
import _wrappedBox from "./factory-components/__placeholder.png";
|
import Factory from "./Factory.vue";
|
||||||
import _wrappedBoxMaker from "./factory-components/__placeholder.png";
|
import metal from "./metal";
|
||||||
|
import oil from "./oil";
|
||||||
|
import paper from "./paper";
|
||||||
|
import plastic from "./plastic";
|
||||||
|
import "./styles/factory.css";
|
||||||
|
import Toy from "./Toy.vue";
|
||||||
|
import toys from "./toys";
|
||||||
|
import trees from "./trees";
|
||||||
|
import workshop from "./workshop";
|
||||||
|
|
||||||
const id = "factory";
|
const id = "factory";
|
||||||
|
|
||||||
|
@ -221,7 +206,10 @@ const factory = createLayer(id, () => {
|
||||||
createMultiplicativeModifier(() => ({
|
createMultiplicativeModifier(() => ({
|
||||||
multiplier: Decimal.lt(energyEfficiency.value, 1)
|
multiplier: Decimal.lt(energyEfficiency.value, 1)
|
||||||
? 1
|
? 1
|
||||||
: Decimal.sub(2, Decimal.div(energyConsumption.value, Decimal.max(computedEnergy.value, 1))),
|
: Decimal.sub(
|
||||||
|
2,
|
||||||
|
Decimal.div(energyConsumption.value, Decimal.max(computedEnergy.value, 1))
|
||||||
|
),
|
||||||
description: "Brighter work rooms",
|
description: "Brighter work rooms",
|
||||||
enabled: () => upgrades[2][0].bought.value
|
enabled: () => upgrades[2][0].bought.value
|
||||||
})),
|
})),
|
||||||
|
@ -302,17 +290,29 @@ const factory = createLayer(id, () => {
|
||||||
|
|
||||||
// ---------------------------------------------- Components
|
// ---------------------------------------------- Components
|
||||||
|
|
||||||
|
|
||||||
function generateComponentDescription(declaration: FactoryComponentDeclaration) {
|
function generateComponentDescription(declaration: FactoryComponentDeclaration) {
|
||||||
|
|
||||||
let str = declaration.inputs === undefined ? "Produces " : "Turns ";
|
let str = declaration.inputs === undefined ? "Produces " : "Turns ";
|
||||||
if (declaration.inputs !== undefined) {
|
if (declaration.inputs !== undefined) {
|
||||||
str += formatList(Object.entries(declaration.inputs)
|
str +=
|
||||||
.map(x => formatWhole(unref(x[1].amount)) + " " + RESOURCES[x[0] as ResourceNames].name)) + " into ";
|
formatList(
|
||||||
|
Object.entries(declaration.inputs).map(
|
||||||
|
x =>
|
||||||
|
formatWhole(unref(x[1].amount)) +
|
||||||
|
" " +
|
||||||
|
RESOURCES[x[0] as ResourceNames].name
|
||||||
|
)
|
||||||
|
) + " into ";
|
||||||
}
|
}
|
||||||
if (declaration.outputs !== undefined) {
|
if (declaration.outputs !== undefined) {
|
||||||
str += formatList(Object.entries(declaration.outputs)
|
str +=
|
||||||
.map(x => formatWhole(unref(x[1].amount)) + " " + RESOURCES[x[0] as ResourceNames].name)) + " per tick.";
|
formatList(
|
||||||
|
Object.entries(declaration.outputs).map(
|
||||||
|
x =>
|
||||||
|
formatWhole(unref(x[1].amount)) +
|
||||||
|
" " +
|
||||||
|
RESOURCES[x[0] as ResourceNames].name
|
||||||
|
)
|
||||||
|
) + " per tick.";
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ const factory = createLayer(id, () => {
|
||||||
imageSrc: _shed,
|
imageSrc: _shed,
|
||||||
extraImage: _wood,
|
extraImage: _wood,
|
||||||
key: "1",
|
key: "1",
|
||||||
name: "Wood Warehouse",
|
name: "Wood Machine",
|
||||||
type: "processor",
|
type: "processor",
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wood)),
|
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wood)),
|
||||||
energyCost: 10,
|
energyCost: 10,
|
||||||
|
@ -386,7 +386,7 @@ const factory = createLayer(id, () => {
|
||||||
imageSrc: _shed,
|
imageSrc: _shed,
|
||||||
extraImage: _cloth,
|
extraImage: _cloth,
|
||||||
key: "2",
|
key: "2",
|
||||||
name: "Cloth Warehouse",
|
name: "Cloth Machine",
|
||||||
type: "processor",
|
type: "processor",
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.cloth)),
|
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.cloth)),
|
||||||
energyCost: 10,
|
energyCost: 10,
|
||||||
|
@ -401,7 +401,7 @@ const factory = createLayer(id, () => {
|
||||||
imageSrc: _shed,
|
imageSrc: _shed,
|
||||||
extraImage: _dye,
|
extraImage: _dye,
|
||||||
key: "3",
|
key: "3",
|
||||||
name: "Dye Warehouse",
|
name: "Dye Machine",
|
||||||
type: "processor",
|
type: "processor",
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.dye)),
|
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.dye)),
|
||||||
energyCost: 10,
|
energyCost: 10,
|
||||||
|
@ -416,7 +416,7 @@ const factory = createLayer(id, () => {
|
||||||
imageSrc: _shed,
|
imageSrc: _shed,
|
||||||
extraImage: _metal,
|
extraImage: _metal,
|
||||||
key: "4",
|
key: "4",
|
||||||
name: "Metal Warehouse",
|
name: "Metal Machine",
|
||||||
type: "processor",
|
type: "processor",
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.metal)),
|
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.metal)),
|
||||||
energyCost: 10,
|
energyCost: 10,
|
||||||
|
@ -431,7 +431,7 @@ const factory = createLayer(id, () => {
|
||||||
imageSrc: _shed,
|
imageSrc: _shed,
|
||||||
extraImage: _plastic,
|
extraImage: _plastic,
|
||||||
key: "5",
|
key: "5",
|
||||||
name: "Plastic Warehouse",
|
name: "Plastic Machine",
|
||||||
type: "processor",
|
type: "processor",
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.plastic)),
|
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.plastic)),
|
||||||
energyCost: 10,
|
energyCost: 10,
|
||||||
|
@ -442,54 +442,6 @@ const factory = createLayer(id, () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} as FactoryComponentDeclaration,
|
} as FactoryComponentDeclaration,
|
||||||
boxes: {
|
|
||||||
imageSrc: _shed,
|
|
||||||
extraImage: _boxes,
|
|
||||||
key: "6",
|
|
||||||
name: "Box Warehouse",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.boxes)),
|
|
||||||
energyCost: 10,
|
|
||||||
tick: 1,
|
|
||||||
outputs: {
|
|
||||||
boxes: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
wrappingPaper: {
|
|
||||||
imageSrc: _shed,
|
|
||||||
extraImage: _wrappingPaper,
|
|
||||||
key: "7",
|
|
||||||
name: "Wrapping Paper Warehouse",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wrappingPaper)),
|
|
||||||
energyCost: 10,
|
|
||||||
tick: 1,
|
|
||||||
outputs: {
|
|
||||||
wrappingPaper: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
ribbon: {
|
|
||||||
imageSrc: _shed,
|
|
||||||
extraImage: _ribbon,
|
|
||||||
key: "8",
|
|
||||||
name: "Ribbon Warehouse",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.ribbon)),
|
|
||||||
energyCost: 10,
|
|
||||||
tick: 1,
|
|
||||||
outputs: {
|
|
||||||
ribbon: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
plank: {
|
plank: {
|
||||||
imageSrc: _plankMaker,
|
imageSrc: _plankMaker,
|
||||||
key: "shift+1",
|
key: "shift+1",
|
||||||
|
@ -632,7 +584,9 @@ const factory = createLayer(id, () => {
|
||||||
key: "shift+8",
|
key: "shift+8",
|
||||||
name: "Circuit Board Manufacturer",
|
name: "Circuit Board Manufacturer",
|
||||||
type: "processor",
|
type: "processor",
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.circuitBoard)),
|
description: computed(() =>
|
||||||
|
generateComponentDescription(FACTORY_COMPONENTS.circuitBoard)
|
||||||
|
),
|
||||||
energyCost: 2,
|
energyCost: 2,
|
||||||
tick: 1,
|
tick: 1,
|
||||||
inputs: {
|
inputs: {
|
||||||
|
@ -650,55 +604,6 @@ const factory = createLayer(id, () => {
|
||||||
},
|
},
|
||||||
visible: main.days[advancedDay - 1].opened
|
visible: main.days[advancedDay - 1].opened
|
||||||
} as FactoryComponentDeclaration,
|
} as FactoryComponentDeclaration,
|
||||||
bow: {
|
|
||||||
imageSrc: _bowMaker,
|
|
||||||
key: "shift+9",
|
|
||||||
name: "Bow Maker",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.bow)),
|
|
||||||
energyCost: 2,
|
|
||||||
tick: 1,
|
|
||||||
inputs: {
|
|
||||||
ribbon: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
bow: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
wrappedBox: {
|
|
||||||
imageSrc: _wrappedBoxMaker,
|
|
||||||
key: "shift+0",
|
|
||||||
name: "Box Wrapper",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wrappedBox)),
|
|
||||||
energyCost: 2,
|
|
||||||
tick: 1,
|
|
||||||
inputs: {
|
|
||||||
boxes: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
wrappingPaper: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
bow: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
ribbon: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
wrappedBox: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
blocks: {
|
blocks: {
|
||||||
imageSrc: _blockMaker,
|
imageSrc: _blockMaker,
|
||||||
key: "ctrl+1",
|
key: "ctrl+1",
|
||||||
|
@ -803,7 +708,9 @@ const factory = createLayer(id, () => {
|
||||||
key: "ctrl+5",
|
key: "ctrl+5",
|
||||||
name: "Shovel and Pail Maker",
|
name: "Shovel and Pail Maker",
|
||||||
type: "processor",
|
type: "processor",
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.bucketShovel)),
|
description: computed(() =>
|
||||||
|
generateComponentDescription(FACTORY_COMPONENTS.bucketShovel)
|
||||||
|
),
|
||||||
energyCost: 20,
|
energyCost: 20,
|
||||||
tick: 1,
|
tick: 1,
|
||||||
inputs: {
|
inputs: {
|
||||||
|
@ -848,144 +755,6 @@ const factory = createLayer(id, () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
visible: main.days[advancedDay - 1].opened
|
visible: main.days[advancedDay - 1].opened
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
wrappedBlocks: {
|
|
||||||
imageSrc: _blockWrapper,
|
|
||||||
key: "ctrl+shift+1",
|
|
||||||
name: "Wooden Block Wrapper",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wrappedBlocks)),
|
|
||||||
energyCost: 20,
|
|
||||||
tick: 1,
|
|
||||||
inputs: {
|
|
||||||
block: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
wrappedBox: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
wrappedBlock: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
wrappedClothes: {
|
|
||||||
imageSrc: _clothesWrapper,
|
|
||||||
key: "ctrl+shift+2",
|
|
||||||
name: "Clothes Wrapper",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wrappedClothes)),
|
|
||||||
energyCost: 20,
|
|
||||||
tick: 1,
|
|
||||||
inputs: {
|
|
||||||
clothes: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
wrappedBox: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
wrappedClothes: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
wrappedTrucks: {
|
|
||||||
imageSrc: _truckWrapper,
|
|
||||||
key: "ctrl+shift+3",
|
|
||||||
name: "Trucks Wrapper",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wrappedTrucks)),
|
|
||||||
energyCost: 20,
|
|
||||||
tick: 1,
|
|
||||||
inputs: {
|
|
||||||
trucks: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
wrappedBox: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
wrappedTrucks: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
wrappedBear: {
|
|
||||||
imageSrc: _bearWrapper,
|
|
||||||
key: "ctrl+shift+4",
|
|
||||||
name: "Teddy Bear Wrapper",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wrappedBear)),
|
|
||||||
energyCost: 20,
|
|
||||||
tick: 1,
|
|
||||||
inputs: {
|
|
||||||
bear: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
wrappedBox: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
wrappedBear: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
wrappedBucketShovel: {
|
|
||||||
imageSrc: _bucketShovelWrapper,
|
|
||||||
key: "ctrl+shift+5",
|
|
||||||
name: "Shovel and Pail Wrapper",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wrappedBucketShovel)),
|
|
||||||
energyCost: 20,
|
|
||||||
tick: 1,
|
|
||||||
inputs: {
|
|
||||||
shovelBucket: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
wrappedBox: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
wrappedShovelBucket: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration,
|
|
||||||
wrappedConsole: {
|
|
||||||
imageSrc: _consoleWrapper,
|
|
||||||
key: "ctrl+shift+6",
|
|
||||||
name: "Game Console Wrapper",
|
|
||||||
type: "processor",
|
|
||||||
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.wrappedConsole)),
|
|
||||||
energyCost: 20,
|
|
||||||
tick: 1,
|
|
||||||
inputs: {
|
|
||||||
console: {
|
|
||||||
amount: 1
|
|
||||||
},
|
|
||||||
wrappedBox: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
wrappedConsole: {
|
|
||||||
amount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visible: main.days[presentsDay - 1].opened
|
|
||||||
} as FactoryComponentDeclaration
|
} as FactoryComponentDeclaration
|
||||||
} as Record<string, FactoryComponentDeclaration>;
|
} as Record<string, FactoryComponentDeclaration>;
|
||||||
const RESOURCES = {
|
const RESOURCES = {
|
||||||
|
@ -1010,18 +779,6 @@ const factory = createLayer(id, () => {
|
||||||
name: "Metal",
|
name: "Metal",
|
||||||
imageSrc: _metal
|
imageSrc: _metal
|
||||||
},
|
},
|
||||||
boxes: {
|
|
||||||
name: "Boxes",
|
|
||||||
imageSrc: _boxes
|
|
||||||
},
|
|
||||||
wrappingPaper: {
|
|
||||||
name: "Wrapping Paper",
|
|
||||||
imageSrc: _wrappingPaper
|
|
||||||
},
|
|
||||||
ribbon: {
|
|
||||||
name: "Ribbon",
|
|
||||||
imageSrc: _ribbon
|
|
||||||
},
|
|
||||||
// Processed resources
|
// Processed resources
|
||||||
plank: {
|
plank: {
|
||||||
name: "Planks",
|
name: "Planks",
|
||||||
|
@ -1055,14 +812,6 @@ const factory = createLayer(id, () => {
|
||||||
name: "Circuit Board",
|
name: "Circuit Board",
|
||||||
imageSrc: _circuitBoard
|
imageSrc: _circuitBoard
|
||||||
},
|
},
|
||||||
bow: {
|
|
||||||
name: "Bow",
|
|
||||||
imageSrc: _bow
|
|
||||||
},
|
|
||||||
wrappedBox: {
|
|
||||||
name: "Wrapped Box",
|
|
||||||
imageSrc: _wrappedBox
|
|
||||||
},
|
|
||||||
// Toys
|
// Toys
|
||||||
block: {
|
block: {
|
||||||
name: "Wooden Blocks",
|
name: "Wooden Blocks",
|
||||||
|
@ -1087,31 +836,6 @@ const factory = createLayer(id, () => {
|
||||||
console: {
|
console: {
|
||||||
name: "Game Console",
|
name: "Game Console",
|
||||||
imageSrc: _console
|
imageSrc: _console
|
||||||
},
|
|
||||||
// Wrapped toys
|
|
||||||
wrappedBlock: {
|
|
||||||
name: "Wrapped Wooden Blocks",
|
|
||||||
imageSrc: _block
|
|
||||||
},
|
|
||||||
wrappedClothes: {
|
|
||||||
name: "Wrapped Clothes",
|
|
||||||
imageSrc: _clothes
|
|
||||||
},
|
|
||||||
wrappedTrucks: {
|
|
||||||
name: "Wrapped Trucks",
|
|
||||||
imageSrc: _truck
|
|
||||||
},
|
|
||||||
wrappedBear: {
|
|
||||||
name: "Wrapped Teddy Bear",
|
|
||||||
imageSrc: _bear
|
|
||||||
},
|
|
||||||
wrappedShovelBucket: {
|
|
||||||
name: "Wrapped Shovel and Pail",
|
|
||||||
imageSrc: _bucketShovel
|
|
||||||
},
|
|
||||||
wrappedConsole: {
|
|
||||||
name: "Wrapped Game Console",
|
|
||||||
imageSrc: _console
|
|
||||||
}
|
}
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -1333,7 +1057,7 @@ const factory = createLayer(id, () => {
|
||||||
showAmount: false
|
showAmount: false
|
||||||
},
|
},
|
||||||
style: "width: 200px",
|
style: "width: 200px",
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})) as GenericBuyable;
|
})) as GenericBuyable;
|
||||||
const oilFuel = createBuyable(() => ({
|
const oilFuel = createBuyable(() => ({
|
||||||
resource: oil.oil,
|
resource: oil.oil,
|
||||||
|
@ -1347,7 +1071,7 @@ const factory = createLayer(id, () => {
|
||||||
showAmount: false
|
showAmount: false
|
||||||
},
|
},
|
||||||
style: "width: 200px",
|
style: "width: 200px",
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})) as GenericBuyable;
|
})) as GenericBuyable;
|
||||||
const carryToys = createBuyable(() => ({
|
const carryToys = createBuyable(() => ({
|
||||||
resource: boxes.boxes,
|
resource: boxes.boxes,
|
||||||
|
@ -1363,7 +1087,7 @@ const factory = createLayer(id, () => {
|
||||||
showAmount: false
|
showAmount: false
|
||||||
},
|
},
|
||||||
style: "width: 200px",
|
style: "width: 200px",
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})) as GenericBuyable;
|
})) as GenericBuyable;
|
||||||
const factoryBuyables = { expandFactory, oilFuel, carryToys };
|
const factoryBuyables = { expandFactory, oilFuel, carryToys };
|
||||||
const upgrades = [
|
const upgrades = [
|
||||||
|
@ -1376,7 +1100,7 @@ const factory = createLayer(id, () => {
|
||||||
description:
|
description:
|
||||||
"Double sawmill consumption and production and metal supplier efficiency"
|
"Double sawmill consumption and production and metal supplier efficiency"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: paper.paper,
|
resource: paper.paper,
|
||||||
|
@ -1385,7 +1109,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "News Ticker",
|
title: "News Ticker",
|
||||||
description: "Paper boosts tick speed"
|
description: "Paper boosts tick speed"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: toys.trucks,
|
resource: toys.trucks,
|
||||||
|
@ -1394,7 +1118,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Haul wood in trucks",
|
title: "Haul wood in trucks",
|
||||||
description: "Trucks multiply wood gain"
|
description: "Trucks multiply wood gain"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: metal.metal,
|
resource: metal.metal,
|
||||||
|
@ -1403,7 +1127,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Diamond-tipped drills",
|
title: "Diamond-tipped drills",
|
||||||
description: "Drill power ^1.2"
|
description: "Drill power ^1.2"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
}))
|
}))
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -1414,7 +1138,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Larger wood pieces",
|
title: "Larger wood pieces",
|
||||||
description: "Wooden block producers produce 3x as much"
|
description: "Wooden block producers produce 3x as much"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: dyes.dyes.red.amount,
|
resource: dyes.dyes.red.amount,
|
||||||
|
@ -1423,7 +1147,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Colorful clothes",
|
title: "Colorful clothes",
|
||||||
description: "Dye producers produce 4x as much"
|
description: "Dye producers produce 4x as much"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: plastic.plastic,
|
resource: plastic.plastic,
|
||||||
|
@ -1432,7 +1156,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Improved plastic producers",
|
title: "Improved plastic producers",
|
||||||
description: "Plastic producers produce 4x as much"
|
description: "Plastic producers produce 4x as much"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: oil.oil,
|
resource: oil.oil,
|
||||||
|
@ -1441,7 +1165,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Capitalism",
|
title: "Capitalism",
|
||||||
description: "Console production is tripled"
|
description: "Console production is tripled"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
}))
|
}))
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -1452,7 +1176,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Brighter work rooms",
|
title: "Brighter work rooms",
|
||||||
description: "Unused electricity makes ticks faster"
|
description: "Unused electricity makes ticks faster"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: dyes.dyes.blue.amount,
|
resource: dyes.dyes.blue.amount,
|
||||||
|
@ -1461,7 +1185,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Colorful teddy bears",
|
title: "Colorful teddy bears",
|
||||||
description: "Teddy bears produce 2x as much"
|
description: "Teddy bears produce 2x as much"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: dyes.dyes.black.amount,
|
resource: dyes.dyes.black.amount,
|
||||||
|
@ -1470,7 +1194,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "New Colors",
|
title: "New Colors",
|
||||||
description: "Unlock white dye"
|
description: "Unlock white dye"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
})),
|
})),
|
||||||
createUpgrade(() => ({
|
createUpgrade(() => ({
|
||||||
resource: boxes.boxes,
|
resource: boxes.boxes,
|
||||||
|
@ -1479,7 +1203,7 @@ const factory = createLayer(id, () => {
|
||||||
title: "Carry ticks in boxes",
|
title: "Carry ticks in boxes",
|
||||||
description: "Tick speed x1.5"
|
description: "Tick speed x1.5"
|
||||||
},
|
},
|
||||||
visible: () => showIf(main.days[advancedDay - 1].opened.value)
|
visibility: () => showIf(main.days[advancedDay - 1].opened.value)
|
||||||
}))
|
}))
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
@ -1515,6 +1239,9 @@ const factory = createLayer(id, () => {
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
|
|
||||||
globalBus.on("onLoad", async () => {
|
globalBus.on("onLoad", async () => {
|
||||||
|
if (loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loaded = false;
|
loaded = false;
|
||||||
|
|
||||||
spriteContainer.destroy({
|
spriteContainer.destroy({
|
||||||
|
@ -1843,7 +1570,11 @@ const factory = createLayer(id, () => {
|
||||||
lastProdTimes: !isConveyor ? (reactive([]) as number[]) : undefined,
|
lastProdTimes: !isConveyor ? (reactive([]) as number[]) : undefined,
|
||||||
lastFactoryProd: !isConveyor
|
lastFactoryProd: !isConveyor
|
||||||
? Date.now() -
|
? Date.now() -
|
||||||
1000 * Decimal.div(data.ticksDone ?? 0, computedActualTickRate.value).toNumber()
|
1000 *
|
||||||
|
Decimal.div(
|
||||||
|
(data as FactoryComponentProcessor).ticksDone ?? 0,
|
||||||
|
computedActualTickRate.value
|
||||||
|
).toNumber()
|
||||||
: undefined,
|
: undefined,
|
||||||
average: !isConveyor
|
average: !isConveyor
|
||||||
? computed(() => {
|
? computed(() => {
|
||||||
|
@ -1867,7 +1598,7 @@ const factory = createLayer(id, () => {
|
||||||
const compData = components.value[x + "x" + y] as FactoryComponentProcessor;
|
const compData = components.value[x + "x" + y] as FactoryComponentProcessor;
|
||||||
if (factoryBaseData.inputs !== undefined) {
|
if (factoryBaseData.inputs !== undefined) {
|
||||||
for (const [res, val] of Object.entries(factoryBaseData.inputs))
|
for (const [res, val] of Object.entries(factoryBaseData.inputs))
|
||||||
if ((compData.inputStock?.[res as ResourceNames] ?? 0) < val.amount)
|
if ((compData.inputStock?.[res as ResourceNames] ?? 0) < unref(val.amount))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (factoryBaseData.outputs !== undefined) {
|
if (factoryBaseData.outputs !== undefined) {
|
||||||
|
@ -2110,6 +1841,9 @@ const factory = createLayer(id, () => {
|
||||||
{Object.entries(FACTORY_COMPONENTS).map(value => {
|
{Object.entries(FACTORY_COMPONENTS).map(value => {
|
||||||
const key = value[0] as FactoryCompNames;
|
const key = value[0] as FactoryCompNames;
|
||||||
const item = value[1];
|
const item = value[1];
|
||||||
|
if (unref(item.visible) === false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div class="comp">
|
<div class="comp">
|
||||||
<img
|
<img
|
||||||
|
@ -2209,32 +1943,41 @@ const factory = createLayer(id, () => {
|
||||||
compInternalHovered.value.type !== "conveyor" ? (
|
compInternalHovered.value.type !== "conveyor" ? (
|
||||||
<>
|
<>
|
||||||
{showStockAmount(
|
{showStockAmount(
|
||||||
compHovered.value.inputStock,
|
(compHovered.value as FactoryComponentProcessor).inputStock,
|
||||||
FACTORY_COMPONENTS[compHovered.value.type].inputs,
|
FACTORY_COMPONENTS[compHovered.value.type].inputs,
|
||||||
"Inputs:"
|
"Inputs:"
|
||||||
)}
|
)}
|
||||||
{showStockAmount(
|
{showStockAmount(
|
||||||
compHovered.value.outputStock,
|
(compHovered.value as FactoryComponentProcessor).outputStock,
|
||||||
FACTORY_COMPONENTS[compHovered.value.type].outputs,
|
FACTORY_COMPONENTS[compHovered.value.type].outputs,
|
||||||
"Outputs:",
|
"Outputs:",
|
||||||
false
|
false
|
||||||
)}
|
)}
|
||||||
<br />
|
<br />
|
||||||
Efficency:{" "}
|
Efficency:{" "}
|
||||||
{compInternalHovered.value.average.value !== undefined ? (
|
{(compInternalHovered.value as FactoryInternalProcessor).average.value !==
|
||||||
|
undefined ? (
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
color:
|
color:
|
||||||
compInternalHovered.value.average.value > 1
|
(compInternalHovered.value as FactoryInternalProcessor)
|
||||||
|
.average.value! > 1
|
||||||
? "purple"
|
? "purple"
|
||||||
: compInternalHovered.value.average.value >= 0.9
|
: (
|
||||||
|
compInternalHovered.value as FactoryInternalProcessor
|
||||||
|
).average.value! >= 0.9
|
||||||
? "green"
|
? "green"
|
||||||
: compInternalHovered.value.average.value >= 0.5
|
: (
|
||||||
|
compInternalHovered.value as FactoryInternalProcessor
|
||||||
|
).average.value! >= 0.5
|
||||||
? "yellow"
|
? "yellow"
|
||||||
: "red"
|
: "red"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{formatWhole(compInternalHovered.value.average.value * 100)}
|
{formatWhole(
|
||||||
|
(compInternalHovered.value as FactoryInternalProcessor).average
|
||||||
|
.value! * 100
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
"--"
|
"--"
|
||||||
|
@ -2476,4 +2219,4 @@ const factory = createLayer(id, () => {
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export default factory;
|
export default factory;
|
Loading…
Reference in a new issue