diff --git a/core/src/mindustry/graphics/Drawf.java b/core/src/mindustry/graphics/Drawf.java index 0dbf5a5b3379..936a1df763ef 100644 --- a/core/src/mindustry/graphics/Drawf.java +++ b/core/src/mindustry/graphics/Drawf.java @@ -325,14 +325,18 @@ public static void liquid(TextureRegion region, float x, float y, float alpha, C Draw.color(); } - public static void dashCircle(float x, float y, float rad, Color color){ - Lines.stroke(3f, Pal.gray); + public static void dashCircle(float x, float y, float rad, Color color, float alpha){ + Lines.stroke(3f, Tmp.c1.set(Pal.gray).mulA(alpha)); Lines.dashCircle(x, y, rad); - Lines.stroke(1f, color); + Lines.stroke(1f, Tmp.c1.set(color).mulA(alpha)); Lines.dashCircle(x, y, rad); Draw.reset(); } + public static void dashCircle(float x, float y, float rad, Color color){ + dashCircle(x, y, rad, color, 1f); + } + public static void circles(float x, float y, float rad){ circles(x, y, rad, Pal.accent); } @@ -373,6 +377,18 @@ public static void square(float x, float y, float radius){ square(x, y, radius, 45); } + public static void polygon(float x, float y, int sides, float radius, float rotation, Color color, float alpha){ + Lines.stroke(3f, Tmp.c1.set(Pal.gray).mulA(alpha)); + Lines.poly(x, y, sides, radius, rotation); + Lines.stroke(1f, Tmp.c1.set(color).mulA(alpha)); + Lines.poly(x, y, sides, radius, rotation); + Draw.reset(); + } + + public static void polygon(float x, float y, int sides, float radius, float rotation, Color color){ + polygon(x, y, sides, radius, rotation, color, 1f); + } + public static void arrow(float x, float y, float x2, float y2, float length, float radius){ arrow(x, y, x2, y2, length, radius, Pal.accent); } diff --git a/core/src/mindustry/world/blocks/defense/ForceProjector.java b/core/src/mindustry/world/blocks/defense/ForceProjector.java index 33c8b2a0f648..cfb8215e555e 100644 --- a/core/src/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/mindustry/world/blocks/defense/ForceProjector.java @@ -108,14 +108,11 @@ public void setStats(){ @Override public void drawPlace(int x, int y, int rotation, boolean valid){ super.drawPlace(x, y, rotation, valid); + float wx = x * tilesize + offset, wy = y * tilesize + offset; - Draw.color(Pal.gray); - Lines.stroke(3f); - Lines.poly(x * tilesize + offset, y * tilesize + offset, sides, radius, shieldRotation); - Draw.color(player.team().color); - Lines.stroke(1f); - Lines.poly(x * tilesize + offset, y * tilesize + offset, sides, radius, shieldRotation); - Draw.color(); + if(itemConsumer != null) Drawf.polygon(wx, wy, sides, radius + phaseRadiusBoost, shieldRotation, player.team().color, 0.5f); + + Drawf.polygon(wx, wy, sides, radius, shieldRotation, player.team().color); } public class ForceBuild extends Building implements Ranged{ @@ -262,6 +259,19 @@ public void drawShield(){ Draw.reset(); } + @Override + public void drawSelect(){ + super.drawSelect(); + float realRad = realRadius(); + + float boostRad = radius + phaseRadiusBoost; + if(realRad < boostRad && itemConsumer != null){ + Drawf.polygon(x, y, sides, boostRad, shieldRotation, team.color, 0.5f - Mathf.curve(realRad, radius + phaseRadiusBoost * 0.9f, boostRad) / 2f); + } + + if(realRad < radius) Drawf.polygon(x, y, sides, radius, shieldRotation, team.color, 1f - Mathf.curve(realRad, radius * 0.9f, radius)); + } + @Override public void write(Writes write){ super.write(write); diff --git a/core/src/mindustry/world/blocks/defense/MendProjector.java b/core/src/mindustry/world/blocks/defense/MendProjector.java index 751873d70a08..01f05f043e09 100644 --- a/core/src/mindustry/world/blocks/defense/MendProjector.java +++ b/core/src/mindustry/world/blocks/defense/MendProjector.java @@ -25,6 +25,7 @@ public class MendProjector extends Block{ public float healPercent = 12f; public float phaseBoost = 12f; public float phaseRangeBoost = 50f; + public boolean hasBoost = true; public float useTime = 400f; public MendProjector(String name){ @@ -53,17 +54,26 @@ public void setStats(){ stats.add(Stat.repairTime, (int)(100f / healPercent * reload / 60f), StatUnit.seconds); stats.add(Stat.range, range / tilesize, StatUnit.blocks); - stats.add(Stat.boostEffect, phaseRangeBoost / tilesize, StatUnit.blocks); - stats.add(Stat.boostEffect, (phaseBoost + healPercent) / healPercent, StatUnit.timesSpeed); + if(hasBoost){ + stats.add(Stat.boostEffect, phaseRangeBoost / tilesize, StatUnit.blocks); + stats.add(Stat.boostEffect, (phaseBoost + healPercent) / healPercent, StatUnit.timesSpeed); + } } @Override public void drawPlace(int x, int y, int rotation, boolean valid){ super.drawPlace(x, y, rotation, valid); - - Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range, baseColor); + float wx = x * tilesize + offset, wy = y * tilesize + offset; + + if(hasBoost){ + indexer.eachBlock(player.team(), wx, wy, range + phaseRangeBoost, other -> Mathf.dst(x * tilesize + offset, y * tilesize + offset, other.x, other.y) >= range, other -> Drawf.selected(other, Tmp.c1.set(phaseColor).a(Mathf.absin(4f, 1f) / 2f))); + + Drawf.dashCircle(wx, wy, range + phaseRangeBoost, phaseColor, 0.5f); + } + + indexer.eachBlock(player.team(), wx, wy, range, other -> true, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f)))); - indexer.eachBlock(player.team(), x * tilesize + offset, y * tilesize + offset, range, other -> true, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f)))); + Drawf.dashCircle(wx, wy, range, baseColor); } public class MendBuild extends Building implements Ranged{ @@ -82,7 +92,9 @@ public void updateTile(){ heat = Mathf.lerpDelta(heat, efficiency > 0 && canHeal ? 1f : 0f, 0.08f); charge += heat * delta(); - phaseHeat = Mathf.lerpDelta(phaseHeat, optionalEfficiency, 0.1f); + if(hasBoost){ + phaseHeat = Mathf.lerpDelta(phaseHeat, optionalEfficiency, 0.1f); + } if(optionalEfficiency > 0 && timer(timerUse, useTime) && canHeal){ consume(); @@ -110,6 +122,13 @@ public double sense(LAccess sensor){ public void drawSelect(){ float realRange = range + phaseHeat * phaseRangeBoost; + if(hasBoost && phaseHeat <= 0.999f){ + float a = 0.5f - Mathf.curve(phaseHeat, 0.9f, 1f) / 2f; + indexer.eachBlock(this, range + phaseRangeBoost, other -> dst(other) >= range, other -> Drawf.selected(other, Tmp.c1.set(phaseColor).a(Mathf.absin(4f, 1f) * a))); + + Drawf.dashCircle(x, y, range + phaseRangeBoost, phaseColor, a); + } + indexer.eachBlock(this, realRange, other -> true, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f)))); Drawf.dashCircle(x, y, realRange, baseColor); diff --git a/core/src/mindustry/world/blocks/defense/OverdriveProjector.java b/core/src/mindustry/world/blocks/defense/OverdriveProjector.java index ed83edcee42e..2e7e82c4dde4 100644 --- a/core/src/mindustry/world/blocks/defense/OverdriveProjector.java +++ b/core/src/mindustry/world/blocks/defense/OverdriveProjector.java @@ -52,10 +52,17 @@ public boolean outputsItems(){ @Override public void drawPlace(int x, int y, int rotation, boolean valid){ super.drawPlace(x, y, rotation, valid); + float wx = x * tilesize + offset, wy = y * tilesize + offset; - Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range, baseColor); + if(hasBoost){ + indexer.eachBlock(player.team(), wx, wy, range + phaseRangeBoost, other -> other.block.canOverdrive && Mathf.dst(x * tilesize + offset, y * tilesize + offset, other.x, other.y) >= range, other -> Drawf.selected(other, Tmp.c1.set(phaseColor).a(Mathf.absin(4f, 1f) / 2f))); + + Drawf.dashCircle(wx, wy, range + phaseRangeBoost, phaseColor, 0.5f); + } + + indexer.eachBlock(player.team(), wx, wy, range, other -> other.block.canOverdrive, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f)))); - indexer.eachBlock(player.team(), x * tilesize + offset, y * tilesize + offset, range, other -> other.block.canOverdrive, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f)))); + Drawf.dashCircle(wx, wy, range, baseColor); } @Override @@ -122,6 +129,13 @@ public float realBoost(){ public void drawSelect(){ float realRange = range + phaseHeat * phaseRangeBoost; + if(hasBoost && phaseHeat <= 0.999f){ + float a = 0.5f - Mathf.curve(phaseHeat, 0.9f, 1f) / 2f; + indexer.eachBlock(this, range + phaseRangeBoost, other -> other.block.canOverdrive && dst(other) >= range, other -> Drawf.selected(other, Tmp.c1.set(phaseColor).a(Mathf.absin(4f, 1f) * a))); + + Drawf.dashCircle(x, y, range + phaseRangeBoost, phaseColor, a); + } + indexer.eachBlock(this, realRange, other -> other.block.canOverdrive, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f)))); Drawf.dashCircle(x, y, realRange, baseColor);