1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Implement tryTakeItem in UndergroundBelt

This commit is contained in:
isaisstillalive 2020-07-03 01:44:31 +09:00
parent 3305b62e00
commit 223e0e2615
3 changed files with 16 additions and 16 deletions

View File

@ -214,6 +214,7 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
{
pos: new Vector(0, 0),
directions: [enumDirection.bottom],
processor: "UndergroundBelt",
},
]);
return;

View File

@ -70,6 +70,21 @@ export class UndergroundBeltComponent extends Component {
this.cachedLinkedEntity = null;
}
/**
*
* @param {BaseItem} item
* @param {number} slot
*/
tryTakeItem(item, slot) {
// Its an underground belt. yay.
if (this.tryAcceptExternalItem(item, 0)) {
return true;
}
// Underground belt can have nothing else
return false;
}
/**
* Tries to accept an item from an external source like a regular belt or building
* @param {BaseItem} item

View File

@ -295,22 +295,6 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
// Energy consumer can have more components
}
const undergroundBeltComp = receiver.components.UndergroundBelt;
if (undergroundBeltComp) {
// Its an underground belt. yay.
if (
undergroundBeltComp.tryAcceptExternalItem(
item,
this.root.hubGoals.getUndergroundBeltBaseSpeed()
)
) {
return true;
}
// Underground belt can have nothing else
return false;
}
return false;
}