You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.2 KiB
74 lines
2.2 KiB
import { globalConfig } from "../../core/config";
|
|
import { enumDirection, Vector } from "../../core/vector";
|
|
import { ItemAcceptorComponent, enumItemAcceptorItemFilter } 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 MetaStackerBuilding extends MetaBuilding {
|
|
constructor() {
|
|
super("stacker");
|
|
}
|
|
|
|
getName() {
|
|
return "Combine";
|
|
}
|
|
|
|
getSilhouetteColor() {
|
|
return "#9fcd7d";
|
|
}
|
|
|
|
getDescription() {
|
|
return "Combines both items. If they can not be merged, the right item is placed above the left item.";
|
|
}
|
|
|
|
getDimensions() {
|
|
return new Vector(2, 1);
|
|
}
|
|
|
|
/**
|
|
* @param {GameRoot} root
|
|
*/
|
|
getIsUnlocked(root) {
|
|
return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_stacker);
|
|
}
|
|
|
|
/**
|
|
* Creates the entity at the given location
|
|
* @param {Entity} entity
|
|
*/
|
|
setupEntityComponents(entity) {
|
|
entity.addComponent(
|
|
new ItemProcessorComponent({
|
|
inputsPerCharge: 2,
|
|
processorType: enumItemProcessorTypes.stacker,
|
|
})
|
|
);
|
|
|
|
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: enumItemAcceptorItemFilter.shape,
|
|
},
|
|
{
|
|
pos: new Vector(1, 0),
|
|
directions: [enumDirection.bottom],
|
|
filter: enumItemAcceptorItemFilter.shape,
|
|
},
|
|
],
|
|
})
|
|
);
|
|
}
|
|
}
|