1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-15 11:11:51 +00:00

Prevent filter and tunnel from deleting extra acceptor items

This commit is contained in:
Sense101 2022-01-25 18:30:14 +00:00
parent cd72da5023
commit cb4ccdbb79
2 changed files with 4 additions and 5 deletions

View File

@ -4,8 +4,6 @@ import { Entity } from "../entity";
import { GameSystemWithFilter } from "../game_system_with_filter"; import { GameSystemWithFilter } from "../game_system_with_filter";
import { BOOL_TRUE_SINGLETON } from "../items/boolean_item"; import { BOOL_TRUE_SINGLETON } from "../items/boolean_item";
const MAX_ITEMS_IN_QUEUE = 2;
export class FilterSystem extends GameSystemWithFilter { export class FilterSystem extends GameSystemWithFilter {
constructor(root) { constructor(root) {
super(root, [FilterComponent]); super(root, [FilterComponent]);
@ -21,7 +19,8 @@ export class FilterSystem extends GameSystemWithFilter {
// Take items from acceptor // Take items from acceptor
const input = acceptorComp.completedInputs[0]; const input = acceptorComp.completedInputs[0];
if (input && this.tryAcceptItem(entity, input.item, input.extraProgress)) { if (input && this.tryAcceptItem(entity, input.item, input.extraProgress)) {
acceptorComp.completedInputs = []; // only remove one
acceptorComp.completedInputs.splice(0);
} }
// Output to ejector // Output to ejector
@ -64,7 +63,7 @@ export class FilterSystem extends GameSystemWithFilter {
listToCheck = filterComp.pendingItemsToReject; listToCheck = filterComp.pendingItemsToReject;
} }
if (listToCheck.length >= MAX_ITEMS_IN_QUEUE) { if (!listToCheck.length) {
// Busy // Busy
return false; return false;
} }

View File

@ -323,7 +323,7 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
input.extraProgress input.extraProgress
) )
) { ) {
acceptorComp.completedInputs = []; acceptorComp.completedInputs.splice(0);
} }
} }
} }