Merge branch 'Anuken:master' into enableNonlinkedBlocksOnProcDeletion

This commit is contained in:
Cardillan 2025-11-20 12:01:43 +01:00 committed by GitHub
commit b6ac1122fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -68,8 +68,6 @@ public class CanvasBlock extends Block{
clipSize = Math.max(clipSize, size * 8 - padding);
previewPixmap = new Pixmap(canvasSize, canvasSize);
if(!Mathf.isPowerOfTwo(palette.length)) throw new RuntimeException("Non power-of-two palettes for canvas blocks are not supported.");
}
@Override
@ -122,7 +120,6 @@ public class CanvasBlock extends Block{
}
}
}
}else{
super.drawPlanRegion(plan, list);
}
@ -134,7 +131,7 @@ public class CanvasBlock extends Block{
for(int i = 0; i < pixels; i++){
int bitOffset = i * bpp;
int pal = getByte(data, bitOffset);
target.set(i % canvasSize, i / canvasSize, palette[pal]);
target.set(i % canvasSize, i / canvasSize, palette[Math.min(pal, palette.length)]);
}
return target;
}

View file

@ -35,6 +35,8 @@ public class LogicBlock extends Block{
private static final int maxLinks = 6000;
public static final int maxNameLength = 32;
private static final IntSet usedBuildings = new IntSet();
public int maxInstructionScale = 5;
public int instructionsPerTick = 1;
//privileged only
@ -268,6 +270,7 @@ public class LogicBlock extends Block{
stream.readInt();
}
}else{
usedBuildings.clear();
for(int i = 0; i < total; i++){
String name = stream.readUTF();
short x = stream.readShort(), y = stream.readShort();
@ -280,6 +283,9 @@ public class LogicBlock extends Block{
Building build = world.build(x, y);
if(build != null){
if(!usedBuildings.add(build.id)){
continue;
}
String bestName = getLinkName(build.block);
if(!name.startsWith(bestName)){
name = findLinkName(build.block);