Icon generation improvements
This commit is contained in:
@@ -175,6 +175,7 @@ public class Mods implements Loadable{
|
||||
arr.each(c -> {
|
||||
if(c instanceof UnlockableContent && c.minfo.mod != null){
|
||||
UnlockableContent u = (UnlockableContent)c;
|
||||
u.load();
|
||||
u.createIcons(packer);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -443,13 +443,13 @@ public class Block extends UnlockableContent{
|
||||
return editorVariantRegions;
|
||||
}
|
||||
|
||||
protected TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name)};
|
||||
protected TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region};
|
||||
}
|
||||
|
||||
public TextureRegion[] getGeneratedIcons(){
|
||||
if(generatedIcons == null){
|
||||
generatedIcons = generateIcons();
|
||||
generatedIcons = icons();
|
||||
}
|
||||
return generatedIcons;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.defense;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
@@ -15,7 +14,7 @@ import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.tilesize;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class PointDefenseTurret extends Block{
|
||||
public final int timerTarget = timers++;
|
||||
@@ -48,8 +47,8 @@ public class PointDefenseTurret extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find("block-" + size), Core.atlas.find(name)};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{baseRegion, region};
|
||||
}
|
||||
|
||||
public class PointDefenseEntity extends TileEntity{
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Wall extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find("block-" + size), Core.atlas.find(name)};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{baseRegion, region};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.distribution;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
@@ -72,8 +71,8 @@ public class Conveyor extends Block implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-0-0")};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{regions[0][0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.distribution;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
@@ -48,8 +47,8 @@ public class MassDriver extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-base"), Core.atlas.find(name)};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{baseRegion, region};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,7 +32,7 @@ public class PayloadConveyor extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextureRegion[] generateIcons(){
|
||||
protected TextureRegion[] icons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-icon")};
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ public class Floor extends Block{
|
||||
|
||||
Color color = new Color();
|
||||
Color color2 = new Color();
|
||||
PixmapRegion image = Core.atlas.getPixmap((AtlasRegion)generateIcons()[0]);
|
||||
PixmapRegion image = Core.atlas.getPixmap((AtlasRegion)icons()[0]);
|
||||
PixmapRegion edge = Core.atlas.getPixmap("edge-stencil");
|
||||
Pixmap result = new Pixmap(edge.width, edge.height);
|
||||
|
||||
@@ -146,11 +146,6 @@ public class Floor extends Block{
|
||||
packer.add(PageType.environment, name + "-edge", result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBase(Tile tile){
|
||||
Mathf.random.setSeed(tile.pos());
|
||||
|
||||
@@ -26,8 +26,8 @@ public class Rock extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return variants == 0 ? super.generateIcons() : new TextureRegion[]{Core.atlas.find(name + "1")};
|
||||
public TextureRegion[] icons(){
|
||||
return variants == 0 ? super.icons() : new TextureRegion[]{Core.atlas.find(name + "1")};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,7 @@ import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
|
||||
import static mindustry.Vars.tilesize;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Conduit extends LiquidBlock implements Autotiler{
|
||||
public final int timerFlow = timers++;
|
||||
@@ -68,8 +68,8 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find("conduit-bottom"), Core.atlas.find(name + "-top-0")};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{Core.atlas.find("conduit-bottom"), topRegions[0]};
|
||||
}
|
||||
|
||||
public class ConduitEntity extends LiquidBlockEntity{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.liquid;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -22,8 +21,8 @@ public class LiquidBlock extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name + "-top")};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{bottomRegion, topRegion};
|
||||
}
|
||||
|
||||
public class LiquidBlockEntity extends TileEntity{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.liquid;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
@@ -25,8 +24,8 @@ public class LiquidJunction extends LiquidBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name)};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region};
|
||||
}
|
||||
|
||||
public class LiquidJunctionEntity extends TileEntity{
|
||||
|
||||
@@ -60,8 +60,8 @@ public class ImpactReactor extends PowerGenerator{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name)};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{bottomRegion, region};
|
||||
}
|
||||
|
||||
public class FusionReactorEntity extends GeneratorEntity{
|
||||
|
||||
@@ -51,8 +51,8 @@ public class Cultivator extends GenericCrafter{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-top"),};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region, topRegion};
|
||||
}
|
||||
|
||||
public class CultivatorEntity extends GenericCrafterEntity{
|
||||
|
||||
@@ -164,8 +164,8 @@ public class Drill extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-rotator"), Core.atlas.find(name + "-top")};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region, rotatorRegion, topRegion};
|
||||
}
|
||||
|
||||
void countOre(Tile tile){
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.production;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.world.meta.*;
|
||||
@@ -30,8 +29,8 @@ public class Fracker extends SolidPump{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-rotator"), Core.atlas.find(name + "-top")};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region, rotatorRegion, topRegion};
|
||||
}
|
||||
|
||||
public class FrackerEntity extends SolidPumpEntity{
|
||||
|
||||
@@ -61,8 +61,8 @@ public class GenericCrafter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return drawIcons == null ? super.generateIcons() : drawIcons.get();
|
||||
public TextureRegion[] icons(){
|
||||
return drawIcons == null ? super.icons() : drawIcons.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,8 +55,8 @@ public class Pump extends LiquidBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name)};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -80,8 +80,8 @@ public class SolidPump extends Pump{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-rotator"), Core.atlas.find(name + "-top")};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region, rotatorRegion, topRegion};
|
||||
}
|
||||
|
||||
public class SolidPumpEntity extends PumpEntity{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.units;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
@@ -35,8 +34,8 @@ public class Reconstructor extends UnitBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-out"), Core.atlas.find(name + "-top")};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region, outRegion, topRegion};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.units;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
@@ -14,7 +13,7 @@ import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.tilesize;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class RepairPoint extends Block{
|
||||
private static final Rect rect = new Rect();
|
||||
@@ -56,8 +55,8 @@ public class RepairPoint extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-base"), Core.atlas.find(name)};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{baseRegion, region};
|
||||
}
|
||||
|
||||
public class RepairPointEntity extends TileEntity{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mindustry.world.blocks.units;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
@@ -86,8 +85,8 @@ public class UnitFactory extends UnitBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-out"), Core.atlas.find(name + "-top")};
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region, outRegion, topRegion};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user