mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-18 22:09:20 +00:00
make levers, readers and displays selectable/pipettable/deletable from the wires layer
This commit is contained in:
parent
85ff62fa78
commit
ff10961b33
@ -76,6 +76,12 @@ export class HUDLayerPreview extends BaseHUDPart {
|
|||||||
const tileY = dy + startTileY;
|
const tileY = dy + startTileY;
|
||||||
|
|
||||||
const content = this.root.map.getLayerContentXY(tileX, tileY, "wires");
|
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) {
|
if (content) {
|
||||||
MapChunkView.drawSingleWiresOverviewTile({
|
MapChunkView.drawSingleWiresOverviewTile({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|||||||
@ -372,10 +372,24 @@ export class MapChunk {
|
|||||||
assert(localY >= 0, "Local Y is < 0");
|
assert(localY >= 0, "Local Y is < 0");
|
||||||
assert(localX < globalConfig.mapChunkSize, "Local X is >= chunk size");
|
assert(localX < globalConfig.mapChunkSize, "Local X is >= chunk size");
|
||||||
assert(localY < globalConfig.mapChunkSize, "Local Y is >= chunk size");
|
assert(localY < globalConfig.mapChunkSize, "Local Y is >= chunk size");
|
||||||
|
const regularContents = this.contents[localX][localY] || null;
|
||||||
if (layer === "regular") {
|
if (layer === "regular") {
|
||||||
return this.contents[localX][localY] || null;
|
return regularContents;
|
||||||
} else {
|
} 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user