This commit is contained in:
Anuken 2022-04-29 21:44:46 -04:00
parent b696e1c89a
commit c61e058231
4 changed files with 105 additions and 1 deletions

BIN
core/assets/music/fine.ogg Normal file

Binary file not shown.

View File

@ -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);

View File

@ -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

View File

@ -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<Unit> 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;
}
}
}