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:
parent
3305b62e00
commit
223e0e2615
@ -214,6 +214,7 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
|||||||
{
|
{
|
||||||
pos: new Vector(0, 0),
|
pos: new Vector(0, 0),
|
||||||
directions: [enumDirection.bottom],
|
directions: [enumDirection.bottom],
|
||||||
|
processor: "UndergroundBelt",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -70,6 +70,21 @@ export class UndergroundBeltComponent extends Component {
|
|||||||
this.cachedLinkedEntity = null;
|
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
|
* Tries to accept an item from an external source like a regular belt or building
|
||||||
* @param {BaseItem} item
|
* @param {BaseItem} item
|
||||||
|
|||||||
@ -295,22 +295,6 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
|||||||
// Energy consumer can have more components
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user