From 30d8737f677ff8586143fa618177f97bdad50bf0 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 25 Apr 2020 12:49:19 -0400 Subject: [PATCH] Bugfixes --- core/src/mindustry/ai/BlockIndexer.java | 2 +- core/src/mindustry/core/Control.java | 2 +- core/src/mindustry/io/MapIO.java | 8 +++-- core/src/mindustry/world/Block.java | 41 +++++++++++++------------ 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index f79fc74b91..542c193c96 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -321,7 +321,7 @@ public class BlockIndexer{ int quadrantY = tile.y / quadrantSize; itemSet.clear(); - Tile rounded = world.tile(Mathf.clamp(quadrantX * quadrantSize + quadrantSize / 2, 0, world.width() - 1), Mathf.clamp(quadrantY * quadrantSize + quadrantSize / 2, 0, world.height() - 1)); + Tile rounded = world.rawTile(Mathf.clamp(quadrantX * quadrantSize + quadrantSize / 2, 0, world.width() - 1), Mathf.clamp(quadrantY * quadrantSize + quadrantSize / 2, 0, world.height() - 1)); //find all items that this quadrant contains for(int x = Math.max(0, rounded.x - quadrantSize / 2); x < rounded.x + quadrantSize / 2 && x < world.width(); x++){ diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 6c035f1cca..5f1ce60fe2 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -287,7 +287,7 @@ public class Control implements ApplicationListener, Loadable{ public void playTutorial(){ //TODO implement - ui.showInfo("death"); + //ui.showInfo("death"); /* Zone zone = Zones.groundZero; ui.loadAnd(() -> { diff --git a/core/src/mindustry/io/MapIO.java b/core/src/mindustry/io/MapIO.java index e9f505f10e..b31151331a 100644 --- a/core/src/mindustry/io/MapIO.java +++ b/core/src/mindustry/io/MapIO.java @@ -100,8 +100,12 @@ public class MapIO{ ver.region("preview_map", stream, counter, in -> ver.readMap(in, new WorldContext(){ @Override public void resize(int width, int height){} @Override public boolean isGenerating(){return false;} - @Override public void begin(){} - @Override public void end(){} + @Override public void begin(){ + world.setGenerating(true); + } + @Override public void end(){ + world.setGenerating(false); + } @Override public Tile tile(int index){ diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index d3a0a410f1..8a0cdc7d3f 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -179,6 +179,7 @@ public class Block extends UnlockableContent{ public Block(String name){ super(name); this.solid = false; + initEntity(); } //TODO rename to draw() once class refactoring is done. @@ -507,25 +508,7 @@ public class Block extends UnlockableContent{ Arrays.sort(requirements, Structs.comparingInt(i -> i.item.id)); } - @Override - public void displayInfo(Table table){ - ContentDisplay.displayBlock(table, this); - } - - @Override - public ContentType getContentType(){ - return ContentType.block; - } - - /** Called after all blocks are created. */ - @Override - @CallSuper - public void init(){ - //initialize default health based on size - if(health == -1){ - health = size * size * 40; - } - + protected void initEntity(){ if(entityType == null){ //attempt to find the first declared class and use it as the entity type @@ -563,6 +546,26 @@ public class Block extends UnlockableContent{ entityType = TileEntity::create; } } + } + + @Override + public void displayInfo(Table table){ + ContentDisplay.displayBlock(table, this); + } + + @Override + public ContentType getContentType(){ + return ContentType.block; + } + + /** Called after all blocks are created. */ + @Override + @CallSuper + public void init(){ + //initialize default health based on size + if(health == -1){ + health = size * size * 40; + } buildCost = 0f; for(ItemStack stack : requirements){