mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Remove items array since it's no longer used. (working)
This commit is contained in:
parent
605dcd208c
commit
be51f282d5
@ -81,7 +81,7 @@ export class ItemProcessorComponent extends Component {
|
||||
this.processingRequirement = processingRequirement;
|
||||
|
||||
/**
|
||||
* Our current inputs
|
||||
* Our current inputs. Mapping of slot number to item.
|
||||
* @type {Map<number, BaseItem>}
|
||||
*/
|
||||
this.inputSlotsMap = new Map();
|
||||
@ -95,12 +95,6 @@ export class ItemProcessorComponent extends Component {
|
||||
// sure the outputs always match
|
||||
this.nextOutputSlot = 0;
|
||||
|
||||
/**
|
||||
* Our current inputs
|
||||
* @type {Array<{ item: BaseItem, sourceSlot: number }>}
|
||||
*/
|
||||
this.inputSlots = [];
|
||||
|
||||
this.inputSlotsMap.clear();
|
||||
|
||||
/**
|
||||
@ -126,20 +120,12 @@ export class ItemProcessorComponent extends Component {
|
||||
tryTakeItem(item, sourceSlot) {
|
||||
if (specialCaseProcessorTypes.contains(this.type)) {
|
||||
// Hub has special logic .. not really nice but efficient.
|
||||
this.inputSlots.push({ item, sourceSlot });
|
||||
this.inputSlotsMap.set(sourceSlot, item);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check that we only take one item per slot
|
||||
for (let i = 0; i < this.inputSlots.length; ++i) {
|
||||
const slot = this.inputSlots[i];
|
||||
if (slot.sourceSlot === sourceSlot) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.inputSlotsMap.has(sourceSlot)) return false;
|
||||
|
||||
this.inputSlots.push({ item, sourceSlot });
|
||||
this.inputSlotsMap.set(sourceSlot, item);
|
||||
return true;
|
||||
}
|
||||
|
@ -253,14 +253,8 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
||||
const processorComp = entity.components.ItemProcessor;
|
||||
|
||||
// First, take items
|
||||
processorComp.inputSlots = [];
|
||||
|
||||
/** @type {Map<number, BaseItem>} */
|
||||
const itemsBySlotMap = new Map();
|
||||
for (let [key, value] of processorComp.inputSlotsMap.entries()) {
|
||||
itemsBySlotMap.set(key, value);
|
||||
}
|
||||
processorComp.inputSlotsMap.clear();
|
||||
const itemsBySlotMap = processorComp.inputSlotsMap;
|
||||
|
||||
/** @type {Array<ProducedItem>} */
|
||||
const outItems = [];
|
||||
@ -276,6 +270,8 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
||||
outItems,
|
||||
});
|
||||
|
||||
processorComp.inputSlotsMap.clear();
|
||||
|
||||
// Track produced items
|
||||
for (let i = 0; i < outItems.length; ++i) {
|
||||
if (!outItems[i].doNotTrack) {
|
||||
|
Loading…
Reference in New Issue
Block a user