1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00
tobspr_shapez.io/src/js/game/buildings/trash.js

68 lines
1.9 KiB
JavaScript
Raw Normal View History

2020-09-24 14:12:05 +00:00
import { generateMatrixRotations } from "../../core/utils";
2020-05-09 14:45:23 +00:00
import { enumDirection, Vector } from "../../core/vector";
import { ItemAcceptorComponent } from "../components/item_acceptor";
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
2020-05-09 14:45:23 +00:00
import { GameRoot } from "../root";
import { enumHubGoalRewards } from "../tutorial_goals";
2020-05-20 13:51:06 +00:00
2020-09-24 14:12:05 +00:00
const overlayMatrix = generateMatrixRotations([1, 1, 0, 1, 1, 1, 0, 1, 1]);
2020-05-09 14:45:23 +00:00
export class MetaTrashBuilding extends MetaBuilding {
constructor() {
super("trash");
}
getIsRotateable() {
return false;
2020-05-09 14:45:23 +00:00
}
getSilhouetteColor() {
2020-09-24 14:12:05 +00:00
return "#ed1d5d";
2020-05-09 14:45:23 +00:00
}
getDimensions() {
return new Vector(1, 1);
2020-05-20 13:51:06 +00:00
}
2020-09-24 14:12:05 +00:00
getSpecialOverlayRenderMatrix(rotation) {
return overlayMatrix[rotation];
}
2020-05-09 14:45:23 +00:00
/**
* @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, 0),
directions: [
enumDirection.top,
enumDirection.right,
enumDirection.bottom,
enumDirection.left,
],
},
],
})
);
entity.addComponent(
new ItemProcessorComponent({
inputsPerCharge: 1,
processorType: enumItemProcessorTypes.trash,
})
);
2020-05-20 13:51:06 +00:00
}
2020-05-09 14:45:23 +00:00
}