mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-15 11:11:51 +00:00
Fix filter and item acceptor drawing
This commit is contained in:
parent
212c880e75
commit
b5eb759b69
@ -4,6 +4,8 @@ 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]);
|
||||||
@ -62,7 +64,7 @@ export class FilterSystem extends GameSystemWithFilter {
|
|||||||
listToCheck = filterComp.pendingItemsToReject;
|
listToCheck = filterComp.pendingItemsToReject;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!listToCheck.length) {
|
if (listToCheck.length >= MAX_ITEMS_IN_QUEUE) {
|
||||||
// Busy
|
// Busy
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ export class ItemAcceptorSystem extends GameSystemWithFilter {
|
|||||||
|
|
||||||
if (!chunk.tileSpaceRectangle.containsPoint(realSlotPos.x, realSlotPos.y)) {
|
if (!chunk.tileSpaceRectangle.containsPoint(realSlotPos.x, realSlotPos.y)) {
|
||||||
// Not within this chunk
|
// Not within this chunk
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fadeOutDirection =
|
const fadeOutDirection =
|
||||||
|
|||||||
@ -285,11 +285,11 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
|||||||
// only remove one item from each slot - we don't want to delete extra items!
|
// only remove one item from each slot - we don't want to delete extra items!
|
||||||
let usedSlots = [];
|
let usedSlots = [];
|
||||||
for (let i = 0; i < acceptorComp.completedInputs.length; i++) {
|
for (let i = 0; i < acceptorComp.completedInputs.length; i++) {
|
||||||
const slot = acceptorComp.completedInputs[i].slotIndex;
|
const index = acceptorComp.completedInputs[i].slotIndex;
|
||||||
|
|
||||||
if (!usedSlots.includes(slot)) {
|
if (!usedSlots.includes(index)) {
|
||||||
usedSlots.push(slot);
|
usedSlots.push(index);
|
||||||
acceptorComp.completedInputs.splice(i);
|
acceptorComp.completedInputs.splice(i, 1);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user