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

added Multi Layer Copying

This commit is contained in:
Christopher-Robin 2020-10-07 04:15:31 +11:00
parent d33a72202a
commit 129c2baec7
No known key found for this signature in database
GPG Key ID: 39A83BF9D91CC108

View File

@ -243,8 +243,9 @@ export class HUDMassSelector extends BaseHUDPart {
for(let x = realTileStart.x; x <= realTileEnd.x; ++x) { for(let x = realTileStart.x; x <= realTileEnd.x; ++x) {
for(let y = realTileStart.y; y <= realTileEnd.y; ++y) { for(let y = realTileStart.y; y <= realTileEnd.y; ++y) {
const contents = this.root.map.getLayerContentXY(x, y, this.root.currentLayer);
if (contents && this.root.logic.canDeleteBuilding(contents)) { for(let contents of this.root.map.getLayersContentsMultipleXY(x, y)){
if(this.root.logic.canDeleteBuilding(contents))
this.selectedUids.add(contents.uid); this.selectedUids.add(contents.uid);
} }
} }
@ -294,16 +295,18 @@ export class HUDMassSelector extends BaseHUDPart {
for(let x = realTileStart.x; x <= realTileEnd.x; ++x) { for(let x = realTileStart.x; x <= realTileEnd.x; ++x) {
for(let y = realTileStart.y; y <= realTileEnd.y; ++y) { for(let y = realTileStart.y; y <= realTileEnd.y; ++y) {
const contents = this.root.map.getLayerContentXY(x, y, this.root.currentLayer);
if (contents && this.root.logic.canDeleteBuilding(contents)) { for(let component of this.root.map.getLayersContentsMultipleXY(x, y)) {
if(component && this.root.logic.canDeleteBuilding(component)) {
// Prevent rendering the overlay twice // Prevent rendering the overlay twice
const uid = contents.uid; const uid = component.uid;
if(renderedUids.has(uid)) { if(renderedUids.has(uid)) {
continue; continue;
} }
renderedUids.add(uid); renderedUids.add(uid);
const staticComp = contents.components.StaticMapEntity; const staticComp = component.components.StaticMapEntity;
const bounds = staticComp.getTileSpaceBounds(); const bounds = staticComp.getTileSpaceBounds();
parameters.context.beginRoundedRect( parameters.context.beginRoundedRect(
bounds.x * globalConfig.tileSize + boundsBorder, bounds.x * globalConfig.tileSize + boundsBorder,
@ -317,6 +320,7 @@ export class HUDMassSelector extends BaseHUDPart {
} }
} }
} }
}
parameters.context.fillStyle = THEME.map.selectionOverlay; parameters.context.fillStyle = THEME.map.selectionOverlay;
this.selectedUids.forEach(uid => { this.selectedUids.forEach(uid => {