1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Fix building placer not showing slots properly

This commit is contained in:
tobspr
2020-08-10 21:36:46 +02:00
parent 93975df4d5
commit d2077f5009
4 changed files with 113 additions and 93 deletions

View File

@@ -93,7 +93,7 @@ export class BeltComponent extends Component {
* Returns fake acceptor slot used for matching
* @returns {import("./item_ejector").ItemEjectorSlot}
*/
getFakeEjectorSlots() {
getFakeEjectorSlot() {
assert(
FAKE_BELT_EJECTOR_SLOT_BY_DIRECTION[this.direction],
"Invalid belt direction: ",

View File

@@ -90,11 +90,10 @@ export class ItemEjectorComponent extends Component {
/**
* Returns where this slot ejects to
* @param {number} index
* @param {ItemEjectorSlot} slot
* @returns {Vector}
*/
getSlotTargetLocalTile(index) {
const slot = this.slots[index];
getSlotTargetLocalTile(slot) {
const directionVector = enumDirectionToVector[slot.direction];
return slot.pos.add(directionVector);
}
@@ -105,7 +104,7 @@ export class ItemEjectorComponent extends Component {
*/
anySlotEjectsToLocalTile(tile) {
for (let i = 0; i < this.slots.length; ++i) {
if (this.getSlotTargetLocalTile(i).equals(tile)) {
if (this.getSlotTargetLocalTile(this.slots[i]).equals(tile)) {
return true;
}
}