dimension limits
This commit is contained in:
@@ -1087,6 +1087,7 @@ ability.stat.minspeed = [stat]{0} tiles/sec[lightgray] min speed
|
||||
ability.stat.duration = [stat]{0} sec[lightgray] duration
|
||||
ability.stat.buildtime = [stat]{0} sec[lightgray] build time
|
||||
|
||||
bar.displaytoolarge = Dimensions too large\n(Max: {0}x{0})
|
||||
bar.onlycoredeposit = Only Core Depositing Allowed
|
||||
bar.drilltierreq = Better Drill Required
|
||||
bar.noresources = Missing Resources
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package mindustry.world.blocks.logic;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.graphics.gl.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
@@ -15,6 +17,9 @@ public class TileableLogicDisplay extends LogicDisplay{
|
||||
protected static final Seq<TileableLogicDisplayBuild> displays = new Seq<>();
|
||||
protected static final IntSet processed = new IntSet();
|
||||
|
||||
//in tiles
|
||||
public int maxDisplayDimensions = 12;
|
||||
|
||||
public TileableLogicDisplay(String name){
|
||||
super(name);
|
||||
|
||||
@@ -79,6 +84,15 @@ public class TileableLogicDisplay extends LogicDisplay{
|
||||
//size of display area
|
||||
public int tilesWidth = 1, tilesHeight = 1, originX, originY;
|
||||
|
||||
@Override
|
||||
public void display(Table table){
|
||||
super.display(table);
|
||||
|
||||
if(tilesWidth > maxDisplayDimensions || tilesHeight > maxDisplayDimensions){
|
||||
table.row().add(Core.bundle.format("bar.displaytoolarge", maxDisplayDimensions, maxDisplayDimensions)).color(Color.scarlet).growX().wrap();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.rect(block.region, x, y);
|
||||
@@ -88,9 +102,8 @@ public class TileableLogicDisplay extends LogicDisplay{
|
||||
|
||||
if(isRoot()){
|
||||
Draw.draw(Draw.z(), () -> {
|
||||
if(buffer == null){
|
||||
if(buffer == null && tilesWidth <= maxDisplayDimensions && tilesHeight <= maxDisplayDimensions){
|
||||
buffer = new FrameBuffer(32 * tilesWidth, 32 * tilesHeight);
|
||||
Log.info("create " + buffer.getWidth() + " " + buffer.getHeight());
|
||||
//clear the buffer - some OSs leave garbage in it
|
||||
buffer.begin(Pal.darkerMetal);
|
||||
buffer.end();
|
||||
|
||||
Reference in New Issue
Block a user