Misc block rendering cleanup

This commit is contained in:
Anuken 2022-09-27 12:29:27 -04:00
parent f7a34cfa46
commit b873392309
20 changed files with 78 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 296 B

View File

@ -8,8 +8,8 @@ import mindustry.entities.*;
import mindustry.entities.abilities.*;
import mindustry.entities.bullet.*;
import mindustry.entities.effect.*;
import mindustry.entities.part.*;
import mindustry.entities.part.DrawPart.*;
import mindustry.entities.part.*;
import mindustry.entities.pattern.*;
import mindustry.gen.*;
import mindustry.graphics.*;
@ -1042,7 +1042,7 @@ public class Blocks{
craftTime = 10f;
hasLiquids = hasPower = true;
drawer = new DrawMulti(new DrawDefault(), new DrawLiquidRegion());
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(), new DrawDefault());
consumePower(1f);
consumeItem(Items.scrap, 1);
@ -1062,6 +1062,8 @@ public class Blocks{
consumePower(1.1f);
consumeLiquid(Liquids.slag, 4f / 60f);
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(), new DrawRegion("-spinner", 3), new DrawDefault());
}};
disassembler = new Separator("disassembler"){{
@ -1080,6 +1082,8 @@ public class Blocks{
consumePower(4f);
consumeItem(Items.scrap);
consumeLiquid(Liquids.slag, 0.12f);
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(), new DrawRegion("-spinner", 3), new DrawDefault());
}};
sporePress = new GenericCrafter("spore-press"){{

View File

@ -1,5 +1,6 @@
package mindustry.world.blocks.distribution;
import arc.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.scene.ui.layout.*;
@ -49,6 +50,11 @@ public class Sorter extends Block{
return build == null || build.sortItem == null ? 0 : build.sortItem.color.rgba();
}
@Override
protected TextureRegion[] icons(){
return new TextureRegion[]{Core.atlas.find("source-bottom"), region};
}
public class SorterBuild extends Building{
public @Nullable Item sortItem;
@ -63,15 +69,16 @@ public class Sorter extends Block{
@Override
public void draw(){
super.draw();
if(sortItem == null){
Draw.rect("cross", x, y);
Draw.rect("cross-full", x, y);
}else{
Draw.color(sortItem.color);
Draw.rect("center", x, y);
Fill.square(x, y, tilesize/2f - 0.00001f);
Draw.color();
}
super.draw();
}
@Override

View File

@ -1,17 +1,16 @@
package mindustry.world.blocks.production;
import arc.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.annotations.Annotations.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.consumers.*;
import mindustry.world.draw.*;
import mindustry.world.meta.*;
/**
@ -23,9 +22,7 @@ public class Separator extends Block{
public ItemStack[] results;
public float craftTime;
public @Load("@-liquid") TextureRegion liquidRegion;
public @Load("@-spinner") TextureRegion spinnerRegion;
public float spinnerSpeed = 3f;
public DrawBlock drawer = new DrawDefault();
public Separator(String name){
super(name);
@ -51,6 +48,23 @@ public class Separator extends Block{
consItems = findConsumer(c -> c instanceof ConsumeItems);
}
@Override
public void load(){
super.load();
drawer.load(this);
}
@Override
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
drawer.drawPlan(this, plan, list);
}
@Override
public TextureRegion[] icons(){
return drawer.finalIcons(this);
}
public class SeparatorBuild extends Building{
public float progress;
public float totalProgress;
@ -79,6 +93,7 @@ public class Separator extends Block{
return total < itemCapacity && enabled;
}
/*
@Override
public void draw(){
super.draw();
@ -88,6 +103,32 @@ public class Separator extends Block{
if(Core.atlas.isFound(spinnerRegion)){
Draw.rect(spinnerRegion, x, y, totalProgress * spinnerSpeed);
}
}*/
@Override
public void draw(){
drawer.draw(this);
}
@Override
public void drawLight(){
super.drawLight();
drawer.drawLight(this);
}
@Override
public float warmup(){
return warmup;
}
@Override
public float progress(){
return progress;
}
@Override
public float totalProgress(){
return totalProgress;
}
@Override

View File

@ -1,5 +1,6 @@
package mindustry.world.blocks.sandbox;
import arc.*;
import arc.graphics.g2d.*;
import arc.scene.ui.layout.*;
import arc.util.*;
@ -45,6 +46,11 @@ public class ItemSource extends Block{
stats.add(Stat.output, itemsPerSecond, StatUnit.itemsSecond);
}
@Override
protected TextureRegion[] icons(){
return new TextureRegion[]{Core.atlas.find("source-bottom"), region};
}
@Override
public void drawPlanConfig(BuildPlan plan, Eachable<BuildPlan> list){
drawPlanConfigCenter(plan, plan.config, "center", true);
@ -61,15 +67,15 @@ public class ItemSource extends Block{
@Override
public void draw(){
super.draw();
if(outputItem == null){
Draw.rect("cross", x, y);
Draw.rect("cross-full", x, y);
}else{
Draw.color(outputItem.color);
Draw.rect("center", x, y);
Fill.square(x, y, tilesize/2f - 0.00001f);
Draw.color();
}
super.draw();
}
@Override

View File

@ -21,6 +21,11 @@ public class DrawRegion extends DrawBlock{
this.suffix = suffix;
}
public DrawRegion(String suffix, float rotateSpeed){
this.suffix = suffix;
this.rotateSpeed = rotateSpeed;
}
public DrawRegion(){
}