fixed router update

This commit is contained in:
Anuken
2022-04-29 22:10:31 -04:00
parent 76ec6591a5
commit 2dd8cb01ec
3 changed files with 10 additions and 4 deletions

View File

@@ -4265,6 +4265,7 @@ public class Blocks{
requirements(Category.units, with(Items.graphite, 90, Items.silicon, 90, Items.tungsten, 80)); requirements(Category.units, with(Items.graphite, 90, Items.silicon, 90, Items.tungsten, 80));
size = 2; size = 2;
range = 100f;
consumePower(1f); consumePower(1f);
consumeLiquid(Liquids.hydrogen, 3f / 60f); consumeLiquid(Liquids.hydrogen, 3f / 60f);

View File

@@ -14,8 +14,9 @@ public class Router extends Block{
public Router(String name){ public Router(String name){
super(name); super(name);
solid = true; solid = false;
underBullets = true; underBullets = true;
update = true;
hasItems = true; hasItems = true;
itemCapacity = 1; itemCapacity = 1;
group = BlockGroup.transportation; group = BlockGroup.transportation;

View File

@@ -18,7 +18,7 @@ public class RepairTower extends Block{
public float range = 80f; public float range = 80f;
public Color circleColor = Pal.heal; public Color circleColor = Pal.heal;
public float circleSpeed = 40f, circleStroke = 3f; public float circleSpeed = 120f, circleStroke = 3f;
public float healAmount = 1f; public float healAmount = 1f;
public RepairTower(String name){ public RepairTower(String name){
@@ -46,7 +46,11 @@ public class RepairTower extends Block{
if(potentialEfficiency > 0 && (refresh += Time.delta) >= refreshInterval){ if(potentialEfficiency > 0 && (refresh += Time.delta) >= refreshInterval){
targets.clear(); targets.clear();
refresh = 0f; refresh = 0f;
Units.nearby(team, x, y, range, targets::add); Units.nearby(team, x, y, range, u -> {
if(u.damaged()){
targets.add(u);
}
});
} }
boolean any = false; boolean any = false;
@@ -59,7 +63,7 @@ public class RepairTower extends Block{
} }
} }
warmup = Mathf.lerpDelta(warmup, any ? 1f : 0f, 0.1f); warmup = Mathf.lerpDelta(warmup, any ? efficiency : 0f, 0.1f);
totalProgress += Time.delta / circleSpeed; totalProgress += Time.delta / circleSpeed;
} }