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/components/wire.js

43 lines
930 B
JavaScript
Raw Normal View History

2020-08-11 16:40:09 +00:00
import { Component } from "../component";
/** @enum {string} */
export const enumWireType = {
2020-09-24 10:53:40 +00:00
forward: "forward",
2020-08-11 16:40:09 +00:00
turn: "turn",
split: "split",
2020-08-12 18:11:24 +00:00
cross: "cross",
2020-08-11 16:40:09 +00:00
};
2020-09-24 10:53:40 +00:00
/** @enum {string} */
export const enumWireVariant = {
first: "first",
second: "second",
};
2020-08-11 16:40:09 +00:00
export class WireComponent extends Component {
static getId() {
return "Wire";
}
/**
* @param {object} param0
2020-08-11 18:02:59 +00:00
* @param {enumWireType=} param0.type
2020-09-24 10:53:40 +00:00
* @param {enumWireVariant=} param0.variant
2020-08-11 16:40:09 +00:00
*/
2020-09-24 10:53:40 +00:00
constructor({ type = enumWireType.forward, variant = enumWireVariant.first }) {
2020-08-11 16:40:09 +00:00
super();
this.type = type;
2020-08-13 17:23:00 +00:00
2020-09-24 10:53:40 +00:00
/**
* The variant of the wire, different variants do not connect
* @type {enumWireVariant}
*/
this.variant = variant;
2020-08-13 17:23:00 +00:00
/**
* @type {import("../systems/wire").WireNetwork}
*/
this.linkedNetwork = null;
2020-08-11 16:40:09 +00:00
}
}