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

Fix lots of bugs, add wire splitters / mergers

This commit is contained in:
tobspr
2020-07-06 21:33:37 +02:00
parent 92a2f4caf1
commit 04ea105584
50 changed files with 1233 additions and 1118 deletions

View File

@@ -136,7 +136,25 @@ export class ItemAcceptorComponent extends Component {
*/
canAcceptItem(slotIndex, item) {
const slot = this.slots[slotIndex];
return !slot.filter || slot.filter === item.getItemType();
return this.filterMatches(slot.filter, item);
}
/**
* Returns if the given filter matches
* @param {enumItemType|null} filter
* @param {BaseItem} item
*/
filterMatches(filter, item) {
if (!filter) {
return true;
}
const itemType = item.getItemType();
if (filter === enumItemType.genericEnergy) {
return itemType === enumItemType.positiveEnergy || itemType === enumItemType.negativeEnergy;
}
return itemType === filter;
}
/**

View File

@@ -6,6 +6,7 @@ import { Component } from "../component";
/** @enum {string} */
export const enumItemProcessorTypes = {
splitter: "splitter",
splitterWires: "splitterWires",
cutter: "cutter",
cutterQuad: "cutterQuad",
rotater: "rotater",