mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-15 19:21:49 +00:00
Prevent filter and tunnel from deleting extra acceptor items
This commit is contained in:
parent
cd72da5023
commit
cb4ccdbb79
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -323,7 +323,7 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
|
|||||||
input.extraProgress
|
input.extraProgress
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
acceptorComp.completedInputs = [];
|
acceptorComp.completedInputs.splice(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user