mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-06 02:40:23 -08:00
Merge branch 'Anuken:master' into enableNonlinkedBlocksOnProcDeletion
This commit is contained in:
commit
b6ac1122fe
2 changed files with 7 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue