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

initial take on wire auto-rotation

This commit is contained in:
tobspr
2020-08-11 20:02:59 +02:00
parent a32c0530bb
commit f16ab2389a
18 changed files with 1022 additions and 811 deletions

View File

@@ -18,10 +18,43 @@ export class WireComponent extends Component {
/**
* @param {object} param0
* @param {enumWireType?} param0.type
* @param {enumWireType=} param0.type
*/
constructor({ type = enumWireType.regular }) {
super();
this.type = type;
}
/**
* Returns the local connections
* @returns {import("../../core/utils").DirectionalObject}
*/
getLocalConnections() {
switch (this.type) {
case enumWireType.regular:
return {
top: true,
right: false,
bottom: true,
left: false,
};
case enumWireType.turn:
return {
top: false,
right: true,
bottom: true,
left: false,
};
case enumWireType.split:
return {
top: false,
right: true,
bottom: true,
left: true,
};
default:
assertAlways(false, "Invalid wire type: " + this.type);
}
}
}