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

Implement wire networks, add levers

This commit is contained in:
tobspr
2020-08-13 19:23:00 +02:00
parent 75ab655998
commit 52b4d4d742
46 changed files with 1760 additions and 724 deletions

View File

@@ -0,0 +1,20 @@
import { Component } from "../component";
export class LeverComponent extends Component {
static getId() {
return "Lever";
}
duplicateWithoutContents() {
return new LeverComponent({ toggled: this.toggled });
}
/**
* @param {object} param0
* @param {boolean=} param0.toggled
*/
constructor({ toggled = false }) {
super();
this.toggled = toggled;
}
}

View File

@@ -0,0 +1,26 @@
import { Component } from "../component";
/** @enum {string} */
export const enumLogicGateType = {
and: "and",
};
export class LogicGateComponent extends Component {
static getId() {
return "LogicGate";
}
duplicateWithoutContents() {
return new LogicGateComponent({ type: this.type });
}
/**
*
* @param {object} param0
* @param {enumLogicGateType=} param0.type
*/
constructor({ type = enumLogicGateType.and }) {
super();
this.type = type;
}
}

View File

@@ -24,6 +24,11 @@ export class WireComponent extends Component {
constructor({ type = enumWireType.regular }) {
super();
this.type = type;
/**
* @type {import("../systems/wire").WireNetwork}
*/
this.linkedNetwork = null;
}
/**

View File

@@ -18,7 +18,8 @@ export const enumPinSlotType = {
* pos: Vector,
* type: enumPinSlotType,
* direction: enumDirection,
* value: BaseItem
* value: BaseItem,
* linkedNetwork: import("../systems/wire").WireNetwork
* }} WirePinSlot */
export class WiredPinsComponent extends Component {
@@ -65,6 +66,7 @@ export class WiredPinsComponent extends Component {
type: slotData.type,
direction: slotData.direction,
value: null,
linkedNetwork: null,
});
}
}