diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index acd37bf596..feb58dc320 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -890,7 +890,7 @@ public class Blocks{ size = 2; hasPower = true; hasLiquids = false; - drawer = new DrawMulti(new DrawBlock(), new DrawFlame(Color.valueOf("ffef99"))); + drawer = new DrawMulti(new DrawDefault(), new DrawFlame(Color.valueOf("ffef99"))); ambientSound = Sounds.smelter; ambientSoundVolume = 0.07f; @@ -908,7 +908,7 @@ public class Blocks{ hasLiquids = false; itemCapacity = 30; boostScale = 0.15f; - drawer = new DrawMulti(new DrawBlock(), new DrawFlame(Color.valueOf("ffef99"))); + drawer = new DrawMulti(new DrawDefault(), new DrawFlame(Color.valueOf("ffef99"))); ambientSound = Sounds.smelter; ambientSoundVolume = 0.07f; @@ -927,8 +927,7 @@ public class Blocks{ envEnabled |= Env.space | Env.underwater; envDisabled = Env.none; itemCapacity = 30; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawArcSmelt(), new DrawBlock()); - drawer.iconOverride = new String[]{"-bottom", ""}; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawArcSmelt(), new DrawDefault()); fogRadius = 3; researchCost = with(Items.beryllium, 150, Items.graphite, 50); @@ -943,7 +942,7 @@ public class Blocks{ craftTime = 30f; size = 2; hasPower = hasItems = true; - drawer = new DrawMulti(new DrawBlock(), new DrawFlame(Color.valueOf("ffc099"))); + drawer = new DrawMulti(new DrawDefault(), new DrawFlame(Color.valueOf("ffc099"))); ambientSound = Sounds.smelter; ambientSoundVolume = 0.07f; @@ -962,7 +961,7 @@ public class Blocks{ hasPower = hasLiquids = true; craftEffect = Fx.formsmoke; updateEffect = Fx.plasticburn; - drawer = new DrawMulti(new DrawBlock(), new DrawFade()); + drawer = new DrawMulti(new DrawDefault(), new DrawFade()); consumeLiquid(Liquids.oil, 0.25f); consumePower(3f); @@ -976,8 +975,7 @@ public class Blocks{ craftTime = 120f; size = 2; hasPower = true; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawWeave(), new DrawBlock()); - drawer.iconOverride = new String[]{"-bottom", "-weave", ""}; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawWeave(), new DrawDefault()); envEnabled |= Env.space; ambientSound = Sounds.techloop; @@ -996,7 +994,7 @@ public class Blocks{ size = 3; hasPower = true; itemCapacity = 20; - drawer = new DrawMulti(new DrawBlock(), new DrawFlame()); + drawer = new DrawMulti(new DrawDefault(), new DrawFlame()); consumePower(4f); consumeItems(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3)); @@ -1013,8 +1011,7 @@ public class Blocks{ solid = true; outputsLiquid = true; envEnabled = Env.any; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.cryofluid), new DrawBlock()); - drawer.iconOverride = new String[]{"-bottom", ""}; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.cryofluid), new DrawDefault()); liquidCapacity = 24f; consumePower(1f); @@ -1053,7 +1050,7 @@ public class Blocks{ outputLiquid = new LiquidStack(Liquids.slag, 12f / 60f); craftTime = 1f; hasLiquids = hasPower = true; - drawer = new DrawMulti(new DrawBlock(), new DrawLiquidRegion()); + drawer = new DrawMulti(new DrawDefault(), new DrawLiquidRegion()); consumePower(1f); consumeItem(Items.scrap, 1); @@ -1103,14 +1100,12 @@ public class Blocks{ hasPower = true; craftEffect = Fx.none; drawer = new DrawMulti( - new DrawBlock(), + new DrawDefault(), new DrawFrames(), new DrawLiquidRegion(), new DrawRegion("-top") ); - drawer.iconOverride = new String[]{"", "-top"}; - consumeItem(Items.sporePod, 1); consumePower(0.7f); }}; @@ -1122,11 +1117,10 @@ public class Blocks{ craftTime = 40f; updateEffect = Fx.pulverizeSmall; hasItems = hasPower = true; - drawer = new DrawMulti(new DrawBlock(), new DrawRegion("-rotator"){{ + drawer = new DrawMulti(new DrawDefault(), new DrawRegion("-rotator"){{ spinSprite = true; rotateSpeed = 2f; }}, new DrawRegion("-top")); - drawer.iconOverride = new String[]{"", "-rotator", "-top"}; ambientSound = Sounds.grinding; ambientSoundVolume = 0.025f; @@ -1188,7 +1182,6 @@ public class Blocks{ }} ); - drawer.iconOverride = new String[]{"-bottom", ""}; regionRotated1 = 3; outputLiquids = LiquidStack.with(Liquids.ozone, 4f / 60, Liquids.hydrogen, 6f / 60); liquidOutputDirections = new int[]{1, 3}; @@ -1199,7 +1192,7 @@ public class Blocks{ size = 3; hasLiquids = true; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.nitrogen, 4.1f), new DrawBlock(), new DrawHeatInput(), + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.nitrogen, 4.1f), new DrawDefault(), new DrawHeatInput(), new DrawParticles(){{ color = Color.valueOf("d4f0ff"); alpha = 0.6f; @@ -1232,8 +1225,7 @@ public class Blocks{ rotateDraw = false; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(), new DrawBlock(), new DrawHeatOutput()); - drawer.iconOverride = new String[]{"-bottom", "", "-top1"}; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(), new DrawDefault(), new DrawHeatOutput()); regionRotated1 = 2; craftTime = 60f * 3f; @@ -1246,9 +1238,8 @@ public class Blocks{ researchCostMultiplier = 4f; - drawer = new DrawMulti(new DrawHeatOutput(true)); + drawer = new DrawMulti(new DrawDefault(), new DrawHeatOutput()); rotateDraw = false; - drawer.iconOverride = new String[]{""}; size = 2; heatOutput = 3f; regionRotated1 = 1; @@ -1258,8 +1249,7 @@ public class Blocks{ phaseHeater = new HeatProducer("phase-heater"){{ requirements(Category.crafting, with(Items.oxide, 30, Items.carbide, 30, Items.beryllium, 30)); - drawer = new DrawMulti(new DrawHeatOutput(true)); - drawer.iconOverride = new String[]{""}; + drawer = new DrawMulti(new DrawDefault(), new DrawHeatOutput()); size = 2; heatOutput = 10f; craftTime = 60f * 8f; @@ -1273,7 +1263,7 @@ public class Blocks{ researchCostMultiplier = 10f; size = 3; - drawer = new DrawMulti(new DrawHeatOutput(true), new DrawHeatInput("-heat")); + drawer = new DrawMulti(new DrawDefault(), new DrawHeatOutput(), new DrawHeatInput("-heat")); regionRotated1 = 1; }}; @@ -1291,8 +1281,7 @@ public class Blocks{ size = 3; itemCapacity = 20; hasPower = hasItems = true; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawCrucibleFlame(), new DrawBlock(), new DrawHeatInput()); - drawer.iconOverride = new String[]{"-bottom", ""}; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawCrucibleFlame(), new DrawDefault(), new DrawHeatInput()); ambientSound = Sounds.smelter; ambientSoundVolume = 0.07f; @@ -1324,8 +1313,7 @@ public class Blocks{ }}); } - drawer = new DrawMulti(drawers.and(new DrawBlock())); - drawer.iconOverride = new String[]{"-bottom", ""}; + drawer = new DrawMulti(drawers.and(new DrawDefault())); craftTime = 60f * 2f; @@ -1357,14 +1345,13 @@ public class Blocks{ strokeMax = 2.5f; radius = 10f; amount = 3; - }}, new DrawLiquidRegion(Liquids.slag), new DrawBlock(), new DrawHeatInput(), + }}, new DrawLiquidRegion(Liquids.slag), new DrawDefault(), new DrawHeatInput(), new DrawHeatRegion(){{ color = Color.valueOf("ff6060ff"); }}, new DrawHeatRegion("-vents"){{ color.a = 1f; }}); - drawer.iconOverride = new String[]{"-bottom", ""}; consumeItem(Items.silicon, 3); //TODO must consume from 2 pumps, 1, or 1.5? @@ -1389,9 +1376,7 @@ public class Blocks{ particleLife = 200f; reverse = true; particleSizeInterp = Interp.one; - }}, new DrawBlock(), new DrawHeatInput(), new DrawHeatRegion("-heat-top")); - - drawer.iconOverride = new String[]{"-bottom", ""}; + }}, new DrawDefault(), new DrawHeatInput(), new DrawHeatRegion("-heat-top")); size = 3; @@ -1428,10 +1413,9 @@ public class Blocks{ layerSpeed = -0.9f; }}, new DrawMultiWeave(){{ glowColor = new Color(1f, 0.4f, 0.4f, 0.8f); - }}, new DrawBlock(), new DrawHeatInput(), new DrawHeatRegion("-vents"){{ + }}, new DrawDefault(), new DrawHeatInput(), new DrawHeatRegion("-vents"){{ color = new Color(1f, 0.4f, 0.3f, 1f); }}); - drawer.iconOverride = new String[]{"-bottom", "-weave", ""}; consumeItems(with(Items.thorium, 2, Items.sand, 6)); consumeLiquid(Liquids.ozone, 2f / 60f); @@ -1738,7 +1722,7 @@ public class Blocks{ Color col = Color.valueOf("8ca9e8"); - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.hydrogen, 9f / 4f), new DrawBlock(), new DrawGlowRegion(){{ + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.hydrogen, 9f / 4f), new DrawDefault(), new DrawGlowRegion(){{ color = Color.sky; }}, new DrawPulseShape(false){{ layer = Layer.effect; @@ -2191,7 +2175,7 @@ public class Blocks{ consume(new ConsumeItemFlammable()); consume(new ConsumeItemExplode()); - drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion()); + drawer = new DrawMulti(new DrawDefault(), new DrawWarmupRegion()); }}; thermalGenerator = new ThermalGenerator("thermal-generator"){{ @@ -2212,7 +2196,6 @@ public class Blocks{ consumeLiquid(Liquids.water, 0.1f); hasLiquids = true; size = 2; - drawer.iconOverride = new String[]{"", "-turbine0", "-turbine1"}; generateEffect = Fx.generatespark; ambientSound = Sounds.smelter; @@ -2221,7 +2204,7 @@ public class Blocks{ consume(new ConsumeItemFlammable()); consume(new ConsumeItemExplode()); - drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion(), new DrawTurbines()); + drawer = new DrawMulti(new DrawDefault(), new DrawWarmupRegion(), new DrawTurbines()); }}; differentialGenerator = new ConsumeGenerator("differential-generator"){{ @@ -2235,7 +2218,7 @@ public class Blocks{ generateEffect = Fx.generatespark; ambientSoundVolume = 0.03f; - drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion()); + drawer = new DrawMulti(new DrawDefault(), new DrawWarmupRegion()); consumeItem(Items.pyratite); consumeLiquid(Liquids.cryofluid, 0.1f); @@ -2249,7 +2232,7 @@ public class Blocks{ envEnabled = Env.any; generateEffect = Fx.generatespark; - drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion()); + drawer = new DrawMulti(new DrawDefault(), new DrawWarmupRegion()); consume(new ConsumeItemRadioactive()); }}; @@ -2356,12 +2339,11 @@ public class Blocks{ drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawPistons(){{ sinMag = 3f; sinScl = 5f; - }}, new DrawRegion("-mid"), new DrawLiquidTile(Liquids.arkycite, 37f / 4f), new DrawBlock(), new DrawGlowRegion(){{ + }}, new DrawRegion("-mid"), new DrawLiquidTile(Liquids.arkycite, 37f / 4f), new DrawDefault(), new DrawGlowRegion(){{ alpha = 1f; glowScale = 5f; color = Color.valueOf("c967b099"); }}); - drawer.iconOverride = new String[]{"-bottom", ""}; generateEffect = Fx.none; liquidCapacity = 20f * 5; @@ -2381,7 +2363,7 @@ public class Blocks{ sinScl = 5f; sides = 8; sideOffset = Mathf.PI / 2f; - }}, new DrawRegion("-mid"), new DrawLiquidTile(Liquids.arkycite, 38f / 4f), new DrawBlock(), new DrawGlowRegion(){{ + }}, new DrawRegion("-mid"), new DrawLiquidTile(Liquids.arkycite, 38f / 4f), new DrawDefault(), new DrawGlowRegion(){{ alpha = 1f; glowScale = 5f; color = Pal.slagOrange; @@ -2395,7 +2377,6 @@ public class Blocks{ liquidOutput = new LiquidStack(Liquids.water, 5f / 60f); - drawer.iconOverride = new String[]{"-bottom", ""}; generateEffect = Fx.none; ambientSound = Sounds.smelter; @@ -2487,11 +2468,10 @@ public class Blocks{ legacyReadWarmup = true; drawer = new DrawMulti( - new DrawBlock(), + new DrawDefault(), new DrawCultivator(), new DrawRegion("-top") ); - drawer.iconOverride = new String[]{"", "-top"}; maxBoost = 2f; consumePower(80f / 60f); @@ -2523,8 +2503,7 @@ public class Blocks{ baseEfficiency = 0f; displayEfficiency = false; craftEffect = Fx.turbinegenerate; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawBlurSpin("-rotator", 6f), new DrawRegion("-mid"), new DrawLiquidTile(Liquids.water, 38f / 4f), new DrawBlock()); - drawer.iconOverride = new String[]{"-bottom", "-rotator", ""}; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawBlurSpin("-rotator", 6f), new DrawRegion("-mid"), new DrawLiquidTile(Liquids.water, 38f / 4f), new DrawDefault()); craftTime = 120f; size = 3; ambientSound = Sounds.hum; diff --git a/core/src/mindustry/mod/ClassMap.java b/core/src/mindustry/mod/ClassMap.java index a64dd84ba6..9cd66f8d28 100644 --- a/core/src/mindustry/mod/ClassMap.java +++ b/core/src/mindustry/mod/ClassMap.java @@ -415,11 +415,10 @@ public class ClassMap{ classes.put("DrawLiquidTile", mindustry.world.draw.DrawLiquidTile.class); classes.put("DrawMulti", mindustry.world.draw.DrawMulti.class); classes.put("DrawMultiWeave", mindustry.world.draw.DrawMultiWeave.class); - classes.put("DrawPartial", mindustry.world.draw.DrawPartial.class); classes.put("DrawParticles", mindustry.world.draw.DrawParticles.class); classes.put("DrawPistons", mindustry.world.draw.DrawPistons.class); classes.put("DrawPulseShape", mindustry.world.draw.DrawPulseShape.class); - classes.put("DrawPump", mindustry.world.draw.DrawPump.class); + classes.put("DrawPump", DrawPumpLiquid.class); classes.put("DrawRegion", mindustry.world.draw.DrawRegion.class); classes.put("DrawShape", mindustry.world.draw.DrawShape.class); classes.put("DrawSideRegion", mindustry.world.draw.DrawSideRegion.class); diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 46dd24517e..1c893e5c41 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -135,7 +135,7 @@ public class ContentParser{ if(data.isArray()){ return new DrawMulti(parser.readValue(DrawBlock[].class, data)); } - var bc = resolve(data.getString("type", ""), DrawBlock.class); + var bc = resolve(data.getString("type", ""), DrawDefault.class); data.remove("type"); var result = make(bc); readFields(result, data); diff --git a/core/src/mindustry/world/blocks/defense/RegenProjector.java b/core/src/mindustry/world/blocks/defense/RegenProjector.java index 8001e1340e..1a8663581b 100644 --- a/core/src/mindustry/world/blocks/defense/RegenProjector.java +++ b/core/src/mindustry/world/blocks/defense/RegenProjector.java @@ -29,7 +29,7 @@ public class RegenProjector extends Block{ public float optionalMultiplier = 2f; public float optionalUseTime = 60f * 8f; - public DrawBlock drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawSideRegion(true)); + public DrawBlock drawer = new DrawDefault(); public float effectChance = 0.003f; public Color baseColor = Pal.accent; diff --git a/core/src/mindustry/world/blocks/heat/HeatConductor.java b/core/src/mindustry/world/blocks/heat/HeatConductor.java index ba3ec4752b..a343b05b74 100644 --- a/core/src/mindustry/world/blocks/heat/HeatConductor.java +++ b/core/src/mindustry/world/blocks/heat/HeatConductor.java @@ -13,7 +13,7 @@ import mindustry.world.draw.*; public class HeatConductor extends Block{ public float visualMaxHeat = 15f; - public DrawBlock drawer = new DrawBlock(); + public DrawBlock drawer = new DrawDefault(); public HeatConductor(String name){ super(name); diff --git a/core/src/mindustry/world/blocks/heat/HeatProducer.java b/core/src/mindustry/world/blocks/heat/HeatProducer.java index b1f7446c41..b2bcd8ab2d 100644 --- a/core/src/mindustry/world/blocks/heat/HeatProducer.java +++ b/core/src/mindustry/world/blocks/heat/HeatProducer.java @@ -15,7 +15,7 @@ public class HeatProducer extends GenericCrafter{ public HeatProducer(String name){ super(name); - drawer = new DrawHeatOutput(true); + drawer = new DrawMulti(new DrawDefault(), new DrawHeatOutput()); rotateDraw = false; rotate = true; canOverdrive = false; diff --git a/core/src/mindustry/world/blocks/power/PowerGenerator.java b/core/src/mindustry/world/blocks/power/PowerGenerator.java index b0e47e42a1..cfab097ec4 100644 --- a/core/src/mindustry/world/blocks/power/PowerGenerator.java +++ b/core/src/mindustry/world/blocks/power/PowerGenerator.java @@ -17,7 +17,7 @@ public class PowerGenerator extends PowerDistributor{ /** The amount of power produced per tick in case of an efficiency of 1.0, which represents 100%. */ public float powerProduction; public Stat generationType = Stat.basePowerGeneration; - public DrawBlock drawer = new DrawBlock(); + public DrawBlock drawer = new DrawDefault(); public PowerGenerator(String name){ super(name); diff --git a/core/src/mindustry/world/blocks/production/GenericCrafter.java b/core/src/mindustry/world/blocks/production/GenericCrafter.java index bef7c9ba37..1b91b64d81 100644 --- a/core/src/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/mindustry/world/blocks/production/GenericCrafter.java @@ -41,7 +41,7 @@ public class GenericCrafter extends Block{ /** Only used for legacy cultivator blocks. */ public boolean legacyReadWarmup = false; - public DrawBlock drawer = new DrawBlock(); + public DrawBlock drawer = new DrawDefault(); public GenericCrafter(String name){ super(name); diff --git a/core/src/mindustry/world/blocks/production/Pump.java b/core/src/mindustry/world/blocks/production/Pump.java index 8c1e70de73..304f8a5c74 100644 --- a/core/src/mindustry/world/blocks/production/Pump.java +++ b/core/src/mindustry/world/blocks/production/Pump.java @@ -19,7 +19,7 @@ public class Pump extends LiquidBlock{ public float pumpAmount = 0.2f; /** Interval in-between item consumptions, if applicable. */ public float consumeTime = 60f * 5f; - public DrawBlock draw = new DrawPump(); + public DrawBlock draw = new DrawMulti(new DrawDefault(), new DrawPumpLiquid()); public Pump(String name){ super(name); diff --git a/core/src/mindustry/world/draw/DrawArcSmelt.java b/core/src/mindustry/world/draw/DrawArcSmelt.java index b2ab7e93fd..1c2c5937b7 100644 --- a/core/src/mindustry/world/draw/DrawArcSmelt.java +++ b/core/src/mindustry/world/draw/DrawArcSmelt.java @@ -6,7 +6,7 @@ import arc.math.*; import arc.util.*; import mindustry.gen.*; -public class DrawArcSmelt extends DrawPartial{ +public class DrawArcSmelt extends DrawBlock{ public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585"); public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 3f, flameRadiusMag = 0.3f, circleStroke = 1.5f; diff --git a/core/src/mindustry/world/draw/DrawBlock.java b/core/src/mindustry/world/draw/DrawBlock.java index 7bd68836c8..380a61ca00 100644 --- a/core/src/mindustry/world/draw/DrawBlock.java +++ b/core/src/mindustry/world/draw/DrawBlock.java @@ -12,7 +12,7 @@ import mindustry.world.blocks.production.*; /** An implementation of custom rendering behavior for a crafter block. * This is used mostly for mods. */ -public class DrawBlock{ +public abstract class DrawBlock{ protected static final Rand rand = new Rand(); /** If set, the icon is overridden to be these strings, in order. Each string is a suffix. */ @@ -24,7 +24,7 @@ public class DrawBlock{ /** Draws the block itself. */ public void draw(Building build){ - Draw.rect(build.block.region, build.x, build.y, build.drawrot()); + } /** Draws any extra light for the block. */ @@ -34,7 +34,7 @@ public class DrawBlock{ /** Draws the planned version of this block. */ public void drawPlan(Block block, BuildPlan plan, Eachable list){ - block.drawDefaultPlanRegion(plan, list); + } /** Load any relevant texture regions. */ diff --git a/core/src/mindustry/world/draw/DrawBlurSpin.java b/core/src/mindustry/world/draw/DrawBlurSpin.java index 8e723fa1fe..eadc685047 100644 --- a/core/src/mindustry/world/draw/DrawBlurSpin.java +++ b/core/src/mindustry/world/draw/DrawBlurSpin.java @@ -2,8 +2,6 @@ package mindustry.world.draw; import arc.*; import arc.graphics.g2d.*; -import arc.util.*; -import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.world.*; @@ -28,8 +26,8 @@ public class DrawBlurSpin extends DrawBlock{ } @Override - public void drawPlan(Block block, BuildPlan plan, Eachable list){ - Draw.rect(region, plan.drawx(), plan.drawy()); + public TextureRegion[] icons(Block block){ + return new TextureRegion[]{region}; } @Override diff --git a/core/src/mindustry/world/draw/DrawBubbles.java b/core/src/mindustry/world/draw/DrawBubbles.java index 3216ee2d76..19ea4179ae 100644 --- a/core/src/mindustry/world/draw/DrawBubbles.java +++ b/core/src/mindustry/world/draw/DrawBubbles.java @@ -5,7 +5,7 @@ import arc.graphics.g2d.*; import arc.util.*; import mindustry.gen.*; -public class DrawBubbles extends DrawPartial{ +public class DrawBubbles extends DrawBlock{ public Color color = Color.valueOf("7457ce"); public int amount = 12, sides = 8; diff --git a/core/src/mindustry/world/draw/DrawCircles.java b/core/src/mindustry/world/draw/DrawCircles.java index ea376913e8..106517ddfc 100644 --- a/core/src/mindustry/world/draw/DrawCircles.java +++ b/core/src/mindustry/world/draw/DrawCircles.java @@ -6,7 +6,7 @@ import arc.math.*; import arc.util.*; import mindustry.gen.*; -public class DrawCircles extends DrawPartial{ +public class DrawCircles extends DrawBlock{ public Color color = Color.valueOf("7457ce"); public int amount = 5, sides = 15; diff --git a/core/src/mindustry/world/draw/DrawCrucibleFlame.java b/core/src/mindustry/world/draw/DrawCrucibleFlame.java index 9b5ccb287a..31b0cc50ab 100644 --- a/core/src/mindustry/world/draw/DrawCrucibleFlame.java +++ b/core/src/mindustry/world/draw/DrawCrucibleFlame.java @@ -7,7 +7,7 @@ import arc.math.Interp.*; import arc.util.*; import mindustry.gen.*; -public class DrawCrucibleFlame extends DrawPartial{ +public class DrawCrucibleFlame extends DrawBlock{ public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585"); public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 10f, flameRadiusMag = 0.6f, circleStroke = 1.5f; diff --git a/core/src/mindustry/world/draw/DrawCultivator.java b/core/src/mindustry/world/draw/DrawCultivator.java index e52c2b3d27..c4717baa40 100644 --- a/core/src/mindustry/world/draw/DrawCultivator.java +++ b/core/src/mindustry/world/draw/DrawCultivator.java @@ -8,7 +8,7 @@ import mindustry.gen.*; import mindustry.graphics.*; import mindustry.world.*; -public class DrawCultivator extends DrawPartial{ +public class DrawCultivator extends DrawBlock{ public Color plantColor = Color.valueOf("5541b1"); public Color plantColorLight = Color.valueOf("7457ce"); public Color bottomColor = Color.valueOf("474747"); diff --git a/core/src/mindustry/world/draw/DrawDefault.java b/core/src/mindustry/world/draw/DrawDefault.java new file mode 100644 index 0000000000..8fa7433244 --- /dev/null +++ b/core/src/mindustry/world/draw/DrawDefault.java @@ -0,0 +1,20 @@ +package mindustry.world.draw; + +import arc.graphics.g2d.*; +import arc.util.*; +import mindustry.entities.units.*; +import mindustry.gen.*; +import mindustry.world.*; + +public class DrawDefault extends DrawBlock{ + + @Override + public void draw(Building build){ + Draw.rect(build.block.region, build.x, build.y, build.drawrot()); + } + + @Override + public void drawPlan(Block block, BuildPlan plan, Eachable list){ + block.drawDefaultPlanRegion(plan, list); + } +} diff --git a/core/src/mindustry/world/draw/DrawFlame.java b/core/src/mindustry/world/draw/DrawFlame.java index 05c408b30a..21c359aa44 100644 --- a/core/src/mindustry/world/draw/DrawFlame.java +++ b/core/src/mindustry/world/draw/DrawFlame.java @@ -10,7 +10,7 @@ import mindustry.graphics.*; import mindustry.world.*; //TODO remake/remove -public class DrawFlame extends DrawPartial{ +public class DrawFlame extends DrawBlock{ public Color flameColor = Color.valueOf("ffc999"); public TextureRegion top; public float lightRadius = 60f, lightAlpha = 0.65f, lightSinScl = 10f, lightSinMag = 5; diff --git a/core/src/mindustry/world/draw/DrawFrames.java b/core/src/mindustry/world/draw/DrawFrames.java index f760488beb..52e14240ff 100644 --- a/core/src/mindustry/world/draw/DrawFrames.java +++ b/core/src/mindustry/world/draw/DrawFrames.java @@ -6,7 +6,7 @@ import arc.math.*; import mindustry.gen.*; import mindustry.world.*; -public class DrawFrames extends DrawPartial{ +public class DrawFrames extends DrawBlock{ /** Number of frames to draw. */ public int frames = 3; /** Ticks between frames. */ @@ -24,6 +24,11 @@ public class DrawFrames extends DrawPartial{ build.x, build.y); } + @Override + public TextureRegion[] icons(Block block){ + return new TextureRegion[]{regions[0]}; + } + @Override public void load(Block block){ regions = new TextureRegion[frames]; diff --git a/core/src/mindustry/world/draw/DrawGlowRegion.java b/core/src/mindustry/world/draw/DrawGlowRegion.java index 0789b22b8d..2290578a36 100644 --- a/core/src/mindustry/world/draw/DrawGlowRegion.java +++ b/core/src/mindustry/world/draw/DrawGlowRegion.java @@ -9,7 +9,7 @@ import mindustry.graphics.*; import mindustry.world.*; /** Not standalone. */ -public class DrawGlowRegion extends DrawPartial{ +public class DrawGlowRegion extends DrawBlock{ public Blending blending = Blending.additive; public String suffix = "-glow"; public float alpha = 0.9f, glowScale = 10f, glowIntensity = 0.5f; diff --git a/core/src/mindustry/world/draw/DrawHeatInput.java b/core/src/mindustry/world/draw/DrawHeatInput.java index 4e3ba3624f..5cfef06bfd 100644 --- a/core/src/mindustry/world/draw/DrawHeatInput.java +++ b/core/src/mindustry/world/draw/DrawHeatInput.java @@ -47,7 +47,6 @@ public class DrawHeatInput extends DrawBlock{ } } Draw.z(Layer.block); - } @Override diff --git a/core/src/mindustry/world/draw/DrawHeatOutput.java b/core/src/mindustry/world/draw/DrawHeatOutput.java index d5fd9d6946..9f1077c837 100644 --- a/core/src/mindustry/world/draw/DrawHeatOutput.java +++ b/core/src/mindustry/world/draw/DrawHeatOutput.java @@ -16,19 +16,9 @@ public class DrawHeatOutput extends DrawBlock{ public Color heatColor = new Color(1f, 0.22f, 0.22f, 0.8f); public float heatPulse = 0.3f, heatPulseScl = 10f, glowMult = 1.2f; - public boolean drawRegion = false; - - public DrawHeatOutput(){ - } - - public DrawHeatOutput(boolean drawRegion){ - this.drawRegion = drawRegion; - } @Override public void draw(Building build){ - if(drawRegion) Draw.rect(build.block.region, build.x, build.y); - Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg()); if(build instanceof HeatBlock heater && heater.heat() > 0){ @@ -45,7 +35,6 @@ public class DrawHeatOutput extends DrawBlock{ @Override public void drawPlan(Block block, BuildPlan plan, Eachable list){ - if(drawRegion) Draw.rect(block.region, plan.drawx(), plan.drawy()); Draw.rect(plan.rotation > 1 ? top2 : top1, plan.drawx(), plan.drawy(), plan.rotation * 90); } @@ -57,9 +46,6 @@ public class DrawHeatOutput extends DrawBlock{ top2 = Core.atlas.find(block.name + "-top2"); } - @Override - public TextureRegion[] icons(Block block){ - return new TextureRegion[]{block.region, top1}; - } + //TODO currently no icons due to concerns with rotation } diff --git a/core/src/mindustry/world/draw/DrawHeatRegion.java b/core/src/mindustry/world/draw/DrawHeatRegion.java index 34d91500db..c2cf677506 100644 --- a/core/src/mindustry/world/draw/DrawHeatRegion.java +++ b/core/src/mindustry/world/draw/DrawHeatRegion.java @@ -26,7 +26,6 @@ public class DrawHeatRegion extends DrawBlock{ @Override public void draw(Building build){ - Draw.z(Layer.blockAdditive); if(build instanceof HeatCrafterBuild hc && hc.heat > 0){ Draw.blend(Blending.additive); @@ -36,7 +35,6 @@ public class DrawHeatRegion extends DrawBlock{ Draw.color(); } Draw.z(Layer.block); - } @Override diff --git a/core/src/mindustry/world/draw/DrawLiquidOutputs.java b/core/src/mindustry/world/draw/DrawLiquidOutputs.java index 280cb22f3f..e18e346277 100644 --- a/core/src/mindustry/world/draw/DrawLiquidOutputs.java +++ b/core/src/mindustry/world/draw/DrawLiquidOutputs.java @@ -54,9 +54,9 @@ public class DrawLiquidOutputs extends DrawBlock{ } } - //TODO + //can't display these properly @Override public TextureRegion[] icons(Block block){ - return super.icons(block); + return new TextureRegion[]{}; } } diff --git a/core/src/mindustry/world/draw/DrawLiquidRegion.java b/core/src/mindustry/world/draw/DrawLiquidRegion.java index 9a5ea09b5a..8d4d775afa 100644 --- a/core/src/mindustry/world/draw/DrawLiquidRegion.java +++ b/core/src/mindustry/world/draw/DrawLiquidRegion.java @@ -2,14 +2,13 @@ package mindustry.world.draw; import arc.*; import arc.graphics.g2d.*; -import arc.util.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.type.*; import mindustry.world.*; /** Not standalone. */ -public class DrawLiquidRegion extends DrawPartial{ +public class DrawLiquidRegion extends DrawBlock{ public Liquid drawLiquid; public TextureRegion liquid; public String suffix = "-liquid"; @@ -31,6 +30,7 @@ public class DrawLiquidRegion extends DrawPartial{ ); } + @Override public void load(Block block){ if(!block.hasLiquids){ throw new RuntimeException("Block '" + block + "' has a DrawLiquidRegion, but hasLiquids is false! Make sure it is true."); diff --git a/core/src/mindustry/world/draw/DrawLiquidTile.java b/core/src/mindustry/world/draw/DrawLiquidTile.java index e96acd8b18..96ef29bd86 100644 --- a/core/src/mindustry/world/draw/DrawLiquidTile.java +++ b/core/src/mindustry/world/draw/DrawLiquidTile.java @@ -5,7 +5,7 @@ import mindustry.type.*; import mindustry.world.blocks.liquid.*; /** Not standalone. */ -public class DrawLiquidTile extends DrawPartial{ +public class DrawLiquidTile extends DrawBlock{ public Liquid drawLiquid; public float padding; public float alpha = 1f; diff --git a/core/src/mindustry/world/draw/DrawMulti.java b/core/src/mindustry/world/draw/DrawMulti.java index 04c94ec39b..907e979c84 100644 --- a/core/src/mindustry/world/draw/DrawMulti.java +++ b/core/src/mindustry/world/draw/DrawMulti.java @@ -10,8 +10,6 @@ import mindustry.world.*; /** combined several DrawBlocks into one */ public class DrawMulti extends DrawBlock{ public DrawBlock[] drawers = {}; - /** specifies the drawer index that sources the icon (since there can only be one icon source) */ - public int iconIndex = 0; public DrawMulti(){ } @@ -61,6 +59,10 @@ public class DrawMulti extends DrawBlock{ @Override public TextureRegion[] icons(Block block){ - return drawers.length <= iconIndex ? super.icons(block) : drawers[iconIndex].icons(block); + var result = new Seq(); + for(var draw : drawers){ + result.addAll(draw.icons(block)); + } + return result.toArray(TextureRegion.class); } } diff --git a/core/src/mindustry/world/draw/DrawMultiWeave.java b/core/src/mindustry/world/draw/DrawMultiWeave.java index d11e0b5fe6..33d7b2ff15 100644 --- a/core/src/mindustry/world/draw/DrawMultiWeave.java +++ b/core/src/mindustry/world/draw/DrawMultiWeave.java @@ -30,6 +30,11 @@ public class DrawMultiWeave extends DrawBlock{ Draw.reset(); } + @Override + public TextureRegion[] icons(Block block){ + return new TextureRegion[]{weave}; + } + @Override public void load(Block block){ weave = Core.atlas.find(block.name + "-weave"); diff --git a/core/src/mindustry/world/draw/DrawPartial.java b/core/src/mindustry/world/draw/DrawPartial.java deleted file mode 100644 index 96ef7fccc7..0000000000 --- a/core/src/mindustry/world/draw/DrawPartial.java +++ /dev/null @@ -1,11 +0,0 @@ -package mindustry.world.draw; - -import arc.util.*; -import mindustry.entities.units.*; -import mindustry.world.*; - -public abstract class DrawPartial extends DrawBlock{ - - @Override - public void drawPlan(Block block, BuildPlan plan, Eachable list){} -} diff --git a/core/src/mindustry/world/draw/DrawPulseShape.java b/core/src/mindustry/world/draw/DrawPulseShape.java index e9e1b637dc..36f1e8475a 100644 --- a/core/src/mindustry/world/draw/DrawPulseShape.java +++ b/core/src/mindustry/world/draw/DrawPulseShape.java @@ -10,7 +10,7 @@ import mindustry.graphics.*; import static mindustry.Vars.*; -public class DrawPulseShape extends DrawPartial{ +public class DrawPulseShape extends DrawBlock{ public Color color = Pal.accent.cpy(); public float stroke = 2f, timeScl = 100f, minStroke = 0.2f; public float radiusScl = 1f; diff --git a/core/src/mindustry/world/draw/DrawPump.java b/core/src/mindustry/world/draw/DrawPumpLiquid.java similarity index 86% rename from core/src/mindustry/world/draw/DrawPump.java rename to core/src/mindustry/world/draw/DrawPumpLiquid.java index a771df35a2..e31945d3bd 100644 --- a/core/src/mindustry/world/draw/DrawPump.java +++ b/core/src/mindustry/world/draw/DrawPumpLiquid.java @@ -7,13 +7,11 @@ import mindustry.graphics.*; import mindustry.world.*; import mindustry.world.blocks.production.Pump.*; -public class DrawPump extends DrawBlock{ +public class DrawPumpLiquid extends DrawBlock{ public TextureRegion liquid; @Override public void draw(Building build){ - Draw.rect(build.block.region, build.x, build.y); - if(!(build instanceof PumpBuild pump) || pump.liquidDrop == null) return; Drawf.liquid(liquid, build.x, build.y, build.liquids.get(pump.liquidDrop) / build.block.liquidCapacity, pump.liquidDrop.color); diff --git a/core/src/mindustry/world/draw/DrawRegion.java b/core/src/mindustry/world/draw/DrawRegion.java index bd52e87aea..1a77195ed9 100644 --- a/core/src/mindustry/world/draw/DrawRegion.java +++ b/core/src/mindustry/world/draw/DrawRegion.java @@ -43,6 +43,11 @@ public class DrawRegion extends DrawBlock{ Draw.rect(region, plan.drawx(), plan.drawy()); } + @Override + public TextureRegion[] icons(Block block){ + return new TextureRegion[]{region}; + } + @Override public void load(Block block){ region = Core.atlas.find(block.name + suffix); diff --git a/core/src/mindustry/world/draw/DrawShape.java b/core/src/mindustry/world/draw/DrawShape.java index a5257f69cf..ed6d80c560 100644 --- a/core/src/mindustry/world/draw/DrawShape.java +++ b/core/src/mindustry/world/draw/DrawShape.java @@ -5,7 +5,7 @@ import arc.graphics.g2d.*; import mindustry.gen.*; import mindustry.graphics.*; -public class DrawShape extends DrawPartial{ +public class DrawShape extends DrawBlock{ public Color color = Pal.accent.cpy(); public int sides = 4; public float radius = 2f, timeScl = 1f, layer = -1f, x, y; diff --git a/core/src/mindustry/world/draw/DrawSideRegion.java b/core/src/mindustry/world/draw/DrawSideRegion.java index 3815c203dc..e1b3dfca6a 100644 --- a/core/src/mindustry/world/draw/DrawSideRegion.java +++ b/core/src/mindustry/world/draw/DrawSideRegion.java @@ -8,26 +8,16 @@ import mindustry.gen.*; import mindustry.world.*; public class DrawSideRegion extends DrawBlock{ - public boolean drawRegion = false; public TextureRegion top1, top2; - public DrawSideRegion(){ - } - - public DrawSideRegion(boolean drawRegion){ - this.drawRegion = drawRegion; - } @Override public void draw(Building build){ - if(drawRegion) Draw.rect(build.block.region, build.x, build.y); - Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg()); } @Override public void drawPlan(Block block, BuildPlan plan, Eachable list){ - if(drawRegion) Draw.rect(block.region, plan.drawx(), plan.drawy()); Draw.rect(plan.rotation > 1 ? top2 : top1, plan.drawx(), plan.drawy(), plan.rotation * 90); } @@ -39,7 +29,7 @@ public class DrawSideRegion extends DrawBlock{ @Override public TextureRegion[] icons(Block block){ - return new TextureRegion[]{block.region, top1}; + return new TextureRegion[]{top1}; } } diff --git a/core/src/mindustry/world/draw/DrawSpikes.java b/core/src/mindustry/world/draw/DrawSpikes.java index d20b7c5813..3a19d31628 100644 --- a/core/src/mindustry/world/draw/DrawSpikes.java +++ b/core/src/mindustry/world/draw/DrawSpikes.java @@ -4,7 +4,7 @@ import arc.graphics.*; import arc.graphics.g2d.*; import mindustry.gen.*; -public class DrawSpikes extends DrawPartial{ +public class DrawSpikes extends DrawBlock{ public Color color = Color.valueOf("7457ce"); public int amount = 10, layers = 1; diff --git a/core/src/mindustry/world/draw/DrawTurbines.java b/core/src/mindustry/world/draw/DrawTurbines.java index 0214c044f3..5a8a2b678d 100644 --- a/core/src/mindustry/world/draw/DrawTurbines.java +++ b/core/src/mindustry/world/draw/DrawTurbines.java @@ -2,12 +2,10 @@ package mindustry.world.draw; import arc.*; import arc.graphics.g2d.*; -import arc.util.*; -import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.world.*; -public class DrawTurbines extends DrawPartial{ +public class DrawTurbines extends DrawBlock{ public TextureRegion[] turbines = new TextureRegion[2]; public TextureRegion cap; public float turbineSpeed = 2f; @@ -33,4 +31,9 @@ public class DrawTurbines extends DrawPartial{ turbines[i] = Core.atlas.find(block.name + "-turbine" + i); } } + + @Override + public TextureRegion[] icons(Block block){ + return new TextureRegion[]{turbines[0], turbines[1]}; + } } diff --git a/core/src/mindustry/world/draw/DrawWeave.java b/core/src/mindustry/world/draw/DrawWeave.java index 7b4ac96f27..f8b6aed9ed 100644 --- a/core/src/mindustry/world/draw/DrawWeave.java +++ b/core/src/mindustry/world/draw/DrawWeave.java @@ -8,7 +8,7 @@ import mindustry.gen.*; import mindustry.graphics.*; import mindustry.world.*; -public class DrawWeave extends DrawPartial{ +public class DrawWeave extends DrawBlock{ public TextureRegion weave; @Override