1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Add basic logic gate and improve wires in general

This commit is contained in:
tobspr
2020-08-13 10:23:50 +02:00
parent 93186cbb9f
commit 75ab655998
44 changed files with 1101 additions and 926 deletions

View File

@@ -54,9 +54,9 @@ export class MetaHubBuilding extends MetaBuilding {
new WiredPinsComponent({
slots: [
{
pos: new Vector(3, 0),
pos: new Vector(0, 2),
type: enumPinSlotType.logicalEjector,
direction: enumDirection.top,
direction: enumDirection.left,
},
],
})

View File

@@ -0,0 +1,59 @@
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";
export class MetaLogicGateBuilding extends MetaBuilding {
constructor() {
super("logic_gate");
}
getSilhouetteColor() {
return "#89dc60";
}
/**
* @param {GameRoot} root
*/
getIsUnlocked(root) {
// @todo
return true;
}
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,
},
{
pos: new Vector(0, 0),
direction: enumDirection.left,
type: enumPinSlotType.logicalAcceptor,
},
{
pos: new Vector(0, 0),
direction: enumDirection.right,
type: enumPinSlotType.logicalAcceptor,
},
],
})
);
}
}