mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Fix miner highlight
This commit is contained in:
parent
54f1c1dc93
commit
1f3991301d
@ -45,6 +45,12 @@ export class HUDMinerHighlight extends BaseHUDPart {
|
||||
return;
|
||||
}
|
||||
|
||||
const lowerContents = this.root.map.getLowerLayerContentXY(hoveredTile.x, hoveredTile.y);
|
||||
if (!lowerContents) {
|
||||
// Not connected
|
||||
return;
|
||||
}
|
||||
|
||||
parameters.context.fillStyle = THEME.map.connectedMiners.overlay;
|
||||
|
||||
const connectedEntities = this.findConnectedMiners(contents);
|
||||
|
@ -5,6 +5,7 @@ import { BaseItem } from "../base_item";
|
||||
import { MinerComponent } from "../components/miner";
|
||||
import { Entity } from "../entity";
|
||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||
import { statisticsUnitsSeconds } from "../hud/parts/statistics_handle";
|
||||
import { MapChunkView } from "../map_chunk_view";
|
||||
|
||||
export class MinerSystem extends GameSystemWithFilter {
|
||||
@ -93,6 +94,11 @@ export class MinerSystem extends GameSystemWithFilter {
|
||||
findChainedMiner(entity) {
|
||||
const ejectComp = entity.components.ItemEjector;
|
||||
const staticComp = entity.components.StaticMapEntity;
|
||||
const contentsBelow = this.root.map.getLowerLayerContentXY(staticComp.origin.x, staticComp.origin.y);
|
||||
if (!contentsBelow) {
|
||||
// This miner has no contents
|
||||
return null;
|
||||
}
|
||||
|
||||
const ejectingSlot = ejectComp.slots[0];
|
||||
const ejectingPos = staticComp.localTileToWorld(ejectingSlot.pos);
|
||||
@ -105,7 +111,10 @@ export class MinerSystem extends GameSystemWithFilter {
|
||||
if (targetContents) {
|
||||
const targetMinerComp = targetContents.components.Miner;
|
||||
if (targetMinerComp && targetMinerComp.chainable) {
|
||||
return targetContents;
|
||||
const targetLowerLayer = this.root.map.getLowerLayerContentXY(targetTile.x, targetTile.y);
|
||||
if (targetLowerLayer) {
|
||||
return targetContents;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user