mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
77 lines
2.3 KiB
JavaScript
77 lines
2.3 KiB
JavaScript
import { formatItemsPerSecond } from "../../core/utils";
|
|
import { enumDirection, Vector } from "../../core/vector";
|
|
import { T } from "../../translations";
|
|
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 MetaMixerBuilding extends MetaBuilding {
|
|
constructor() {
|
|
super("mixer");
|
|
}
|
|
|
|
getDimensions() {
|
|
return new Vector(2, 1);
|
|
}
|
|
|
|
getSilhouetteColor() {
|
|
return "#cdbb7d";
|
|
}
|
|
|
|
/**
|
|
* @param {GameRoot} root
|
|
*/
|
|
getIsUnlocked(root) {
|
|
return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_mixer);
|
|
}
|
|
|
|
/**
|
|
* @param {GameRoot} root
|
|
* @param {string} variant
|
|
* @returns {Array<[string, string]>}
|
|
*/
|
|
getAdditionalStatistics(root, variant) {
|
|
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.mixer);
|
|
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
|
}
|
|
|
|
/**
|
|
* Creates the entity at the given location
|
|
* @param {Entity} entity
|
|
*/
|
|
setupEntityComponents(entity) {
|
|
entity.addComponent(
|
|
new ItemProcessorComponent({
|
|
inputsPerCharge: 2,
|
|
processorType: enumItemProcessorTypes.mixer,
|
|
})
|
|
);
|
|
|
|
entity.addComponent(
|
|
new ItemEjectorComponent({
|
|
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
|
})
|
|
);
|
|
entity.addComponent(
|
|
new ItemAcceptorComponent({
|
|
slots: [
|
|
{
|
|
pos: new Vector(0, 0),
|
|
directions: [enumDirection.bottom],
|
|
filter: "color",
|
|
},
|
|
{
|
|
pos: new Vector(1, 0),
|
|
directions: [enumDirection.bottom],
|
|
filter: "color",
|
|
},
|
|
],
|
|
})
|
|
);
|
|
}
|
|
}
|