mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Add constant signal emitters
This commit is contained in:
51
src/js/game/buildings/constant_signal.js
Normal file
51
src/js/game/buildings/constant_signal.js
Normal file
@@ -0,0 +1,51 @@
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { enumLayer, GameRoot } from "../root";
|
||||
import { ConstantSignalComponent } from "../components/constant_signal";
|
||||
|
||||
export class MetaConstantSignalBuilding extends MetaBuilding {
|
||||
constructor() {
|
||||
super("constant_signal");
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#2bafda";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getIsUnlocked(root) {
|
||||
// @todo
|
||||
return G_IS_DEV;
|
||||
}
|
||||
|
||||
getLayer() {
|
||||
return enumLayer.wires;
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
setupEntityComponents(entity) {
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
entity.addComponent(new ConstantSignalComponent({}));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user