import { globalConfig } from "../../core/config"; import { enumDirection, Vector } from "../../core/vector"; import { ItemAcceptorComponent } from "../components/item_acceptor"; import { ItemEjectorComponent } from "../components/item_ejector"; import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor"; import { Entity } from "../entity"; import { MetaBuilding } from "../meta_building"; import { GameRoot } from "../root"; import { enumHubGoalRewards } from "../tutorial_goals"; export class MetaSplitterBuilding extends MetaBuilding { constructor() { super("splitter"); } getDimensions() { return new Vector(2, 1); } getName() { return "Balancer"; } getSilhouetteColor() { return "#444"; } getDescription() { return "Multifunctional - Evenly distributes all inputs onto all outputs."; } /** * @param {GameRoot} root */ getIsUnlocked(root) { return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_splitter); } /** * Creates the entity at the given location * @param {Entity} entity */ setupEntityComponents(entity) { entity.addComponent( new ItemAcceptorComponent({ slots: [ { pos: new Vector(0, 0), directions: [enumDirection.bottom], }, { pos: new Vector(1, 0), directions: [enumDirection.bottom], }, ], }) ); entity.addComponent( new ItemProcessorComponent({ inputsPerCharge: 1, processorType: enumItemProcessorTypes.splitter, beltUnderlays: [ { pos: new Vector(0, 0), direction: enumDirection.top }, { pos: new Vector(1, 0), direction: enumDirection.top }, ], }) ); entity.addComponent( new ItemEjectorComponent({ slots: [ { pos: new Vector(0, 0), direction: enumDirection.top }, { pos: new Vector(1, 0), direction: enumDirection.top }, ], }) ); } }