Removed unused shadow methods; minor tweaks

This commit is contained in:
Anuken
2019-03-29 09:07:46 -04:00
parent 532c36677c
commit 27e9901d05
7 changed files with 12 additions and 30 deletions

View File

@@ -87,6 +87,7 @@ public class Blocks implements ContentList{
air = new Floor("air"){{
alwaysReplace = true;
hasShadow = false;
}
public void draw(Tile tile){}
@@ -735,6 +736,7 @@ public class Blocks implements ContentList{
shockMine = new ShockMine("shock-mine"){{
requirements(Category.effect, ItemStack.with(Items.lead, 50, Items.silicon, 25));
hasShadow = false;
health = 40;
damage = 11;
tileDamage = 7f;
@@ -1096,7 +1098,7 @@ public class Blocks implements ContentList{
}};
unloader = new Unloader("unloader"){{
requirements(Category.distribution, ItemStack.with(Items.titanium, 50, Items.silicon, 60));
requirements(Category.effect, ItemStack.with(Items.titanium, 50, Items.silicon, 60));
speed = 7f;
}};

View File

@@ -57,7 +57,7 @@ public class BlockRenderer{
for(int x = 0; x < world.width(); x++){
for(int y = 0; y < world.height(); y++){
Tile tile = world.rawTile(x, y);
if(tile.block() != Blocks.air){
if(tile.block().hasShadow){
Fill.rect(tile.x + 0.5f, tile.y + 0.5f, 1, 1);
}
}
@@ -125,7 +125,11 @@ public class BlockRenderer{
Draw.proj().setOrtho(0, 0, shadows.getWidth(), shadows.getHeight());
for(Tile tile : shadowEvents){
Draw.color(tile.block() == Blocks.air ? Color.WHITE : shadowColor);
//clear it first
Draw.color(Color.WHITE);
Fill.rect(tile.x + 0.5f, tile.y + 0.5f, 1, 1);
//then draw the shadow
Draw.color(!tile.block().hasShadow ? Color.WHITE : shadowColor);
Fill.rect(tile.x + 0.5f, tile.y + 0.5f, 1, 1);
}
@@ -186,7 +190,6 @@ public class BlockRenderer{
}
if(block.expanded || !expanded){
addRequest(tile, Layer.shadow);
if(block.layer != null && block.isLayer(tile)){
addRequest(tile, block.layer);
@@ -227,9 +230,7 @@ public class BlockRenderer{
BlockRequest req = requests.get(iterateidx);
Block block = req.tile.block();
if(req.layer == Layer.shadow){
block.drawShadow(req.tile);
}else if(req.layer == Layer.block){
if(req.layer == Layer.block){
block.draw(req.tile);
if(block.synthetic() && req.tile.getTeam() != player.getTeam()){
block.drawTeam(req.tile);

View File

@@ -1,8 +1,6 @@
package io.anuke.mindustry.graphics;
public enum Layer{
/**Drawn under everything.*/
shadow,
/**Base block layer.*/
block,
/**for placement*/

View File

@@ -95,6 +95,8 @@ public class Block extends BlockStorage{
public boolean canOverdrive = true;
/**Whether the icon region has an outline added.*/
public boolean outlineIcon = false;
/**Whether this block has a shadow under it.*/
public boolean hasShadow = true;
/**Cost of constructing this block.*/
public ItemStack[] buildRequirements = new ItemStack[]{};
@@ -230,10 +232,6 @@ public class Block extends BlockStorage{
Draw.rect(region, tile.drawx(), tile.drawy(), rotate ? tile.getRotation() * 90 : 0);
}
public void drawShadow(Tile tile){
draw(tile);
}
public void drawTeam(Tile tile){
Draw.color(tile.getTeam().color);
Draw.rect("block-border", tile.drawx() - size * tilesize/2f + 4, tile.drawy() - size * tilesize/2f + 4);

View File

@@ -38,11 +38,6 @@ public class BlockPart extends Block{
//do nothing
}
@Override
public void drawShadow(Tile tile){
//also do nothing
}
@Override
public boolean isSolidFor(Tile tile){
return tile.getLinked() == null

View File

@@ -158,12 +158,6 @@ public class BuildBlock extends Block{
}
}
@Override
public void drawShadow(Tile tile){
//don't
//TODO maybe do
}
@Override
public TileEntity newEntity(){
return new BuildEntity();

View File

@@ -19,12 +19,6 @@ public class TreeBlock extends Block{
@Override
public void draw(Tile tile){}
@Override
public void drawShadow(Tile tile){
Draw.rect(region, tile.drawx(), tile.drawy(), Mathf.randomSeed(tile.pos(), 0, 4) * 90);
Draw.rect(region, tile.drawx() - shadowOffset, tile.drawy() - shadowOffset, Mathf.randomSeed(tile.pos(), 0, 4) * 90);
}
@Override
public void drawLayer(Tile tile){
Draw.rect(region, tile.drawx(), tile.drawy(), Mathf.randomSeed(tile.pos(), 0, 4) * 90);