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

make levers, readers and displays selectable/pipettable/deletable from the wires layer

This commit is contained in:
artemisSystem 2020-10-31 14:24:58 +01:00
parent 85ff62fa78
commit ff10961b33
2 changed files with 22 additions and 2 deletions

View File

@ -76,6 +76,12 @@ export class HUDLayerPreview extends BaseHUDPart {
const tileY = dy + startTileY;
const content = this.root.map.getLayerContentXY(tileX, tileY, "wires");
const contentRegular = this.root.map.getLayerContentXY(tileX, tileY, "regular");
if (contentRegular && content) {
// We don't want to count something on the wires layer here if it is on the normal layer,
// because then it will get rendered twice
continue;
}
if (content) {
MapChunkView.drawSingleWiresOverviewTile({
context: this.context,

View File

@ -372,10 +372,24 @@ export class MapChunk {
assert(localY >= 0, "Local Y is < 0");
assert(localX < globalConfig.mapChunkSize, "Local X is >= chunk size");
assert(localY < globalConfig.mapChunkSize, "Local Y is >= chunk size");
const regularContents = this.contents[localX][localY] || null;
if (layer === "regular") {
return this.contents[localX][localY] || null;
return regularContents;
} else {
return this.wireContents[localX][localY] || null;
const wireContents = this.wireContents[localX][localY] || null;
// If there is a reader, lever, or display on the tile, we count it
// as a wires component and act as if it is on the wires layer.
const regularContentsIsWireComponent =
regularContents ?
regularContents.components.BeltReader ||
regularContents.components.Lever ||
regularContents.components.Display
: false;
if (!wireContents && regularContentsIsWireComponent) {
return regularContents;
} else {
return wireContents;
}
}
}
/**