diff --git a/core/assets/music/fine.ogg b/core/assets/music/fine.ogg new file mode 100644 index 0000000000..5b9dbe5ee4 Binary files /dev/null and b/core/assets/music/fine.ogg differ diff --git a/core/src/mindustry/audio/SoundControl.java b/core/src/mindustry/audio/SoundControl.java index e22d5370aa..93f8fda115 100644 --- a/core/src/mindustry/audio/SoundControl.java +++ b/core/src/mindustry/audio/SoundControl.java @@ -65,7 +65,7 @@ public class SoundControl{ protected void reload(){ current = null; fade = 0f; - ambientMusic = Seq.with(Musics.game1, Musics.game3, Musics.game6, Musics.game8, Musics.game9); + ambientMusic = Seq.with(Musics.game1, Musics.game3, Musics.game6, Musics.game8, Musics.game9, Musics.fine); darkMusic = Seq.with(Musics.game2, Musics.game5, Musics.game7, Musics.game4); bossMusic = Seq.with(Musics.boss1, Musics.boss2, Musics.game2, Musics.game5); diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 4cabb0dee1..cb23c10859 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -145,6 +145,9 @@ public class Blocks{ //TODO maybe making it 5x5 would be more appropriate, seems kinda cheap. basicAssemblerModule, + //TODO + unitRepairTower, + //TODO remove droneCenter, @@ -4258,6 +4261,14 @@ public class Blocks{ droneType = UnitTypes.effectDrone; }}; + unitRepairTower = new RepairTower("unit-repair-tower"){{ + requirements(Category.units, with(Items.graphite, 90, Items.silicon, 90, Items.tungsten, 80)); + + size = 2; + + consumePower(1f); + consumeLiquid(Liquids.hydrogen, 3f / 60f); + }}; //endregion //region payloads diff --git a/core/src/mindustry/world/blocks/units/RepairTower.java b/core/src/mindustry/world/blocks/units/RepairTower.java new file mode 100644 index 0000000000..9ac63a583c --- /dev/null +++ b/core/src/mindustry/world/blocks/units/RepairTower.java @@ -0,0 +1,93 @@ +package mindustry.world.blocks.units; + +import arc.graphics.*; +import arc.graphics.g2d.*; +import arc.math.*; +import arc.struct.*; +import arc.util.*; +import mindustry.entities.*; +import mindustry.gen.*; +import mindustry.graphics.*; +import mindustry.logic.*; +import mindustry.world.*; + +import static mindustry.Vars.*; + +public class RepairTower extends Block{ + static final float refreshInterval = 6f; + + public float range = 80f; + public Color circleColor = Pal.heal; + public float circleSpeed = 40f, circleStroke = 3f; + public float healAmount = 1f; + + public RepairTower(String name){ + super(name); + update = true; + solid = true; + } + + @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, Pal.placing); + } + + public class RepairTowerBuild extends Building implements Ranged{ + public float refresh = Mathf.random(refreshInterval); + public float warmup = 0f; + public float totalProgress = 0f; + public Seq targets = new Seq<>(); + + @Override + public void updateTile(){ + + if(potentialEfficiency > 0 && (refresh += Time.delta) >= refreshInterval){ + targets.clear(); + refresh = 0f; + Units.nearby(team, x, y, range, targets::add); + } + + boolean any = false; + if(efficiency > 0){ + for(var target : targets){ + if(target.damaged()){ + target.heal(healAmount * efficiency); + any = true; + } + } + } + + warmup = Mathf.lerpDelta(warmup, any ? 1f : 0f, 0.1f); + totalProgress += Time.delta / circleSpeed; + } + + @Override + public boolean shouldConsume(){ + return targets.size > 0; + } + + @Override + public void draw(){ + super.draw(); + + Draw.z(Layer.effect); + float mod = totalProgress % 1f; + Draw.color(circleColor); + Lines.stroke(circleStroke * (1f - mod)); + Lines.circle(x, y, range * mod); + Draw.reset(); + } + + @Override + public float range(){ + return range; + } + + @Override + public float warmup(){ + return warmup; + } + } +}