This commit is contained in:
Anuken
2019-09-05 21:44:49 -04:00
parent 5d04f93a88
commit b492c7ae27
9 changed files with 25 additions and 10 deletions

View File

@@ -1407,7 +1407,7 @@ public class Blocks implements ContentList{
arc = new PowerTurret("arc"){{
requirements(Category.turret, ItemStack.with(Items.copper, 35, Items.lead, 50));
shootType = Bullets.arc;
reload = 30f;
reload = 35f;
shootCone = 40f;
rotatespeed = 8f;
powerUse = 1.5f;

View File

@@ -13,11 +13,15 @@ public class ItemDisplay extends Table{
this(item, 0);
}
public ItemDisplay(Item item, int amount){
add(new ItemImage(new ItemStack(item, amount))).size(8 * 4);
add(item.localizedName()).padLeft(4);
public ItemDisplay(Item item, int amount, boolean showName){
add(new ItemImage(new ItemStack(item, amount))).size(8 * 4).padRight(amount > 99 ? 12 : 0);
if(showName) add(item.localizedName()).padLeft(4 + amount > 99 ? 4 : 0);
this.item = item;
this.amount = amount;
}
public ItemDisplay(Item item, int amount){
this(item, amount, true);
}
}

View File

@@ -27,7 +27,7 @@ public class LiquidDisplay extends Table{
t.add(Strings.autoFixed(amount, 1));
add(t);
}
}}).size(8 * 4).padRight(3);
}}).size(8 * 4).padRight(3 + (amount != 0 && Strings.autoFixed(amount, 1).length() > 2 ? 8 : 0));
if(perSecond){
add(StatUnit.perSecond.localized()).padLeft(2).padRight(5).color(Color.LIGHT_GRAY);

View File

@@ -19,7 +19,6 @@ import io.anuke.arc.util.pooling.*;
import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.bullet.*;
import io.anuke.mindustry.entities.effect.*;
import io.anuke.mindustry.entities.type.Unit;
import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
@@ -32,6 +31,7 @@ import io.anuke.mindustry.world.blocks.*;
import io.anuke.mindustry.world.blocks.power.*;
import io.anuke.mindustry.world.consumers.*;
import io.anuke.mindustry.world.meta.*;
import io.anuke.mindustry.world.meta.values.*;
import java.util.*;
@@ -476,7 +476,10 @@ public class Block extends BlockStorage{
public void setStats(){
stats.add(BlockStat.size, "{0}x{0}", size);
stats.add(BlockStat.health, health, StatUnit.none);
stats.add(BlockStat.buildTime, buildCost / 60, StatUnit.seconds);
if(isBuildable()){
stats.add(BlockStat.buildTime, buildCost / 60, StatUnit.seconds);
stats.add(BlockStat.buildCost, new ItemListValue(false, buildRequirements));
}
consumes.display(stats);

View File

@@ -44,7 +44,7 @@ public class CooledTurret extends Turret{
TurretEntity entity = tile.entity();
Liquid liquid = entity.liquids.current();
float used = Math.min(Math.min(entity.liquids.get(liquid), maxUsed * Time.delta()), Math.max(0, ((reload - entity.reload) / coolantMultiplier) / liquid.heatCapacity));
float used = Math.min(Math.min(entity.liquids.get(liquid), maxUsed * Time.delta()), Math.max(0, ((reload - entity.reload) / coolantMultiplier) / liquid.heatCapacity)) * baseReloadSpeed(tile);
entity.reload += (used * liquid.heatCapacity) / liquid.heatCapacity;
entity.liquids.remove(liquid, used);

View File

@@ -201,7 +201,7 @@ public abstract class Turret extends Block{
protected void turnToTarget(Tile tile, float targetRot){
TurretEntity entity = tile.entity();
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * entity.delta());
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * entity.delta() * baseReloadSpeed(tile));
}
public boolean shouldTurn(Tile tile){

View File

@@ -9,6 +9,7 @@ public enum BlockStat{
health(StatCategory.general),
size(StatCategory.general),
buildTime(StatCategory.general),
buildCost(StatCategory.general),
itemCapacity(StatCategory.items),
itemsMoved(StatCategory.items),

View File

@@ -7,15 +7,21 @@ import io.anuke.mindustry.world.meta.StatValue;
public class ItemListValue implements StatValue{
private final ItemStack[] stacks;
private final boolean displayName;
public ItemListValue(ItemStack... stacks){
this(true, stacks);
}
public ItemListValue(boolean displayName, ItemStack... stacks){
this.stacks = stacks;
this.displayName = displayName;
}
@Override
public void display(Table table){
for(ItemStack stack : stacks){
table.add(new ItemDisplay(stack.item, stack.amount)).padRight(5);
table.add(new ItemDisplay(stack.item, stack.amount, displayName)).padRight(5);
}
}
}