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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user