Show that chainable miners can connect to eachother during placement (#613)

Removes the red X when placing a chainable miner feeding into another chainable miner, and instead shows it as a green arrow.
This commit is contained in:
Ryan Liptak 2020-08-31 02:57:51 -07:00 committed by GitHub
parent 5c105d8096
commit bdb08f67d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -454,6 +454,7 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
const ejectorComp = this.fakeEntity.components.ItemEjector;
const staticComp = this.fakeEntity.components.StaticMapEntity;
const beltComp = this.fakeEntity.components.Belt;
const minerComp = this.fakeEntity.components.Miner;
const goodArrowSprite = Loader.getSprite("sprites/misc/slot_good_arrow.png");
const badArrowSprite = Loader.getSprite("sprites/misc/slot_bad_arrow.png");
@ -571,6 +572,7 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
const destEntity = destEntities[i];
const destAcceptor = destEntity.components.ItemAcceptor;
const destStaticComp = destEntity.components.StaticMapEntity;
const destMiner = destEntity.components.Miner;
const destLocalTile = destStaticComp.worldToLocalTile(ejectorSlotWsTile);
const destLocalDir = destStaticComp.worldDirectionToLocal(ejectorSlotWsDirection);
@ -580,6 +582,9 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
} else if (destEntity.components.Belt && destLocalDir === enumDirection.top) {
// Connected to a belt
isConnected = true;
} else if (minerComp && minerComp.chainable && destMiner && destMiner.chainable) {
// Chainable miners connected to eachother
isConnected = true;
} else {
// This one is blocked
isBlocked = true;