mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Fix issues with blueprints
This commit is contained in:
parent
720c288a44
commit
ea868fd750
@ -92,7 +92,7 @@ export class Blueprint {
|
|||||||
let placeable = true;
|
let placeable = true;
|
||||||
placementCheck: for (let x = rect.x; x < rect.right(); ++x) {
|
placementCheck: for (let x = rect.x; x < rect.right(); ++x) {
|
||||||
for (let y = rect.y; y < rect.bottom(); ++y) {
|
for (let y = rect.y; y < rect.bottom(); ++y) {
|
||||||
if (parameters.root.map.isTileUsedXY(x, y)) {
|
if (parameters.root.map.isTileUsedXY(x, y, entity.layer)) {
|
||||||
placeable = false;
|
placeable = false;
|
||||||
break placementCheck;
|
break placementCheck;
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ export class Blueprint {
|
|||||||
rect.moveBy(tile.x, tile.y);
|
rect.moveBy(tile.x, tile.y);
|
||||||
placementCheck: for (let x = rect.x; x < rect.right(); ++x) {
|
placementCheck: for (let x = rect.x; x < rect.right(); ++x) {
|
||||||
for (let y = rect.y; y < rect.bottom(); ++y) {
|
for (let y = rect.y; y < rect.bottom(); ++y) {
|
||||||
if (root.map.isTileUsedXY(x, y)) {
|
if (root.map.isTileUsedXY(x, y, entity.layer)) {
|
||||||
placeable = false;
|
placeable = false;
|
||||||
break placementCheck;
|
break placementCheck;
|
||||||
}
|
}
|
||||||
|
@ -119,17 +119,6 @@ export class BaseMap extends BasicSerializableObject {
|
|||||||
return this.getOrCreateChunkAtTile(x, y).getLowerLayerFromWorldCoords(x, y);
|
return this.getOrCreateChunkAtTile(x, y).getLowerLayerFromWorldCoords(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the tile content of a given tile
|
|
||||||
* @param {number} x
|
|
||||||
* @param {number} y
|
|
||||||
* @returns {Entity} Entity or null
|
|
||||||
*/
|
|
||||||
getTileContentXY(x, y) {
|
|
||||||
const chunk = this.getChunkAtTileOrNull(x, y);
|
|
||||||
return chunk && chunk.getTileContentFromWorldCoords(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tile content of a given tile
|
* Returns the tile content of a given tile
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
@ -156,25 +145,27 @@ export class BaseMap extends BasicSerializableObject {
|
|||||||
/**
|
/**
|
||||||
* Checks if the tile is used
|
* Checks if the tile is used
|
||||||
* @param {Vector} tile
|
* @param {Vector} tile
|
||||||
|
* @param {enumLayer} layer
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isTileUsed(tile) {
|
isTileUsed(tile, layer) {
|
||||||
if (G_IS_DEV) {
|
if (G_IS_DEV) {
|
||||||
this.internalCheckTile(tile);
|
this.internalCheckTile(tile);
|
||||||
}
|
}
|
||||||
const chunk = this.getChunkAtTileOrNull(tile.x, tile.y);
|
const chunk = this.getChunkAtTileOrNull(tile.x, tile.y);
|
||||||
return chunk && chunk.getTileContentFromWorldCoords(tile.x, tile.y) != null;
|
return chunk && chunk.getLayerContentFromWorldCoords(tile.x, tile.y, layer) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the tile is used
|
* Checks if the tile is used
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
|
* @param {enumLayer} layer
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isTileUsedXY(x, y) {
|
isTileUsedXY(x, y, layer) {
|
||||||
const chunk = this.getChunkAtTileOrNull(x, y);
|
const chunk = this.getChunkAtTileOrNull(x, y);
|
||||||
return chunk && chunk.getTileContentFromWorldCoords(x, y) != null;
|
return chunk && chunk.getLayerContentFromWorldCoords(x, y, layer) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user