2020-06-24 20:23:10 +00:00
|
|
|
import { enumDirection, Vector } from "../../core/vector";
|
2020-07-01 15:51:11 +00:00
|
|
|
import { enumItemType } from "../base_item";
|
|
|
|
import { EnergyGeneratorComponent } from "../components/energy_generator";
|
2020-06-27 08:38:11 +00:00
|
|
|
import { ItemAcceptorComponent } from "../components/item_acceptor";
|
2020-07-01 15:51:11 +00:00
|
|
|
import { ItemEjectorComponent } from "../components/item_ejector";
|
|
|
|
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
2020-06-24 20:23:10 +00:00
|
|
|
import { Entity } from "../entity";
|
|
|
|
import { MetaBuilding } from "../meta_building";
|
2020-07-01 15:51:11 +00:00
|
|
|
import { enumLayer, GameRoot } from "../root";
|
2020-06-24 20:23:10 +00:00
|
|
|
import { enumHubGoalRewards } from "../tutorial_goals";
|
2020-07-03 04:17:15 +00:00
|
|
|
import { ItemProcessorComponent, enumItemProcessorTypes } from "../components/item_processor";
|
2020-06-24 20:23:10 +00:00
|
|
|
|
|
|
|
export class MetaEnergyGenerator extends MetaBuilding {
|
|
|
|
constructor() {
|
|
|
|
super("energy_generator");
|
|
|
|
}
|
|
|
|
|
|
|
|
isRotateable(variant) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
getSilhouetteColor() {
|
|
|
|
return "#c425d7";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {GameRoot} root
|
|
|
|
* @param {string} variant
|
|
|
|
* @returns {Array<[string, string]>}
|
|
|
|
*/
|
|
|
|
getAdditionalStatistics(root, variant) {
|
|
|
|
// TODO
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
getDimensions(variant) {
|
|
|
|
return new Vector(2, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {GameRoot} root
|
|
|
|
*/
|
|
|
|
getIsUnlocked(root) {
|
|
|
|
return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_cutter_and_trash);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates the entity at the given location
|
|
|
|
* @param {Entity} entity
|
|
|
|
*/
|
|
|
|
setupEntityComponents(entity) {
|
|
|
|
entity.addComponent(
|
|
|
|
new ItemAcceptorComponent({
|
|
|
|
slots: [
|
|
|
|
{
|
|
|
|
pos: new Vector(0, 1),
|
|
|
|
directions: [enumDirection.bottom],
|
2020-06-27 08:38:11 +00:00
|
|
|
filter: enumItemType.shape,
|
2020-07-02 16:34:36 +00:00
|
|
|
processor: "EnergyGenerator",
|
2020-06-24 20:23:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
pos: new Vector(1, 1),
|
|
|
|
directions: [enumDirection.bottom],
|
2020-06-27 08:38:11 +00:00
|
|
|
filter: enumItemType.shape,
|
2020-07-02 16:34:36 +00:00
|
|
|
processor: "EnergyGenerator",
|
2020-06-24 20:23:10 +00:00
|
|
|
},
|
2020-06-28 17:34:10 +00:00
|
|
|
{
|
|
|
|
pos: new Vector(1, 0),
|
|
|
|
directions: [enumDirection.top],
|
|
|
|
layer: enumLayer.wires,
|
|
|
|
filter: enumItemType.negativeEnergy,
|
2020-07-03 04:17:15 +00:00
|
|
|
processor: "ItemProcessor",
|
2020-06-28 17:34:10 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
entity.addComponent(
|
|
|
|
new ItemEjectorComponent({
|
|
|
|
slots: [
|
|
|
|
{
|
|
|
|
pos: new Vector(0, 0),
|
|
|
|
direction: enumDirection.top,
|
|
|
|
layer: enumLayer.wires,
|
|
|
|
},
|
2020-06-24 20:23:10 +00:00
|
|
|
],
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
entity.addComponent(
|
|
|
|
new EnergyGeneratorComponent({
|
|
|
|
// Set by the energy generator system later
|
|
|
|
requiredKey: null,
|
2020-07-01 15:51:11 +00:00
|
|
|
acceptorSlotIndex: 2,
|
2020-06-24 20:23:10 +00:00
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
entity.addComponent(
|
|
|
|
new WiredPinsComponent({
|
|
|
|
slots: [
|
|
|
|
{
|
|
|
|
pos: new Vector(0, 0),
|
2020-06-28 17:34:10 +00:00
|
|
|
type: enumPinSlotType.positiveEnergyEjector,
|
|
|
|
direction: enumDirection.top,
|
2020-06-24 20:23:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
pos: new Vector(1, 0),
|
2020-06-28 17:34:10 +00:00
|
|
|
type: enumPinSlotType.negativeEnergyAcceptor,
|
|
|
|
direction: enumDirection.top,
|
2020-06-24 20:23:10 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
})
|
|
|
|
);
|
2020-07-03 04:17:15 +00:00
|
|
|
|
|
|
|
entity.addComponent(
|
|
|
|
new ItemProcessorComponent({
|
|
|
|
inputsPerCharge: 1,
|
|
|
|
processorType: enumItemProcessorTypes.trash,
|
|
|
|
})
|
|
|
|
);
|
2020-06-24 20:23:10 +00:00
|
|
|
}
|
|
|
|
}
|