Fix many things

This commit is contained in:
Leonwang4234
2020-11-11 13:27:03 -08:00
parent 3a27e6e94e
commit 4d3c6879b5
5 changed files with 18 additions and 42 deletions

View File

@@ -56,7 +56,6 @@ public enum Stat{
instructions(StatCat.crafting),
weapons(StatCat.function),
mirrored(StatCat.function),
bullet(StatCat.function),
speedIncrease(StatCat.function),

View File

@@ -1,6 +1,7 @@
package mindustry.world.meta.values;
import arc.*;
import arc.func.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.scene.ui.layout.*;
@@ -29,11 +30,12 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
table.row();
for(T t : map.keys()){
BulletType type = map.get(t);
//no point in displaying unit icon twice
if(!(t instanceof UnitType)){
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
table.add(t.localizedName).padRight(10).left().top();
}
table.table(Tex.underline, bt -> {
Cons<Table> tableCons = bt -> {
bt.left().defaults().padRight(3).left();
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
@@ -44,7 +46,8 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1)));
}
if(!Mathf.equal(type.ammoMultiplier, 1f))
//ammo multiplyers do not make sense for units
if(!(t instanceof UnitType) && !Mathf.equal(type.ammoMultiplier, 1f))
sep(bt, Core.bundle.format("bullet.multiplier", (int)type.ammoMultiplier));
if(!Mathf.equal(type.reloadMultiplier, 1f))
sep(bt, Core.bundle.format("bullet.reload", Strings.fixed(type.reloadMultiplier, 1)));
@@ -89,7 +92,12 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
if(type.fragBullet != null){
sep(bt, "@bullet.frag");
}
}).left().padTop(-9);
};
if(t instanceof UnitType){
table.table(tableCons);
}else{
table.table(Tex.underline, tableCons).left().padTop(-9);
}
table.row();
}
}

View File

@@ -6,6 +6,7 @@ import arc.scene.ui.layout.*;
import arc.struct.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
@@ -30,15 +31,16 @@ public class WeaponListValue implements StatValue{
continue;
}
table.image(Core.atlas.find(unit.name + "-weapon" + i)).size(15 * 8).right().top();
if(weapon.outlineRegion.found()){
table.image(weapon.outlineRegion).size(10 * 8).right().top();
}else{
table.image(unit.icon(Cicon.full)).size(10 * 8).right().top();
}
table.table(Tex.underline, w -> {
w.left().defaults().padRight(3).left();
sep(w, "[lightgray]" + Stat.mirrored.localized() + ": [white]" + weapon.mirror);
sep(w, "[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)weapon.inaccuracy + " " + StatUnit.degrees.localized());
sep(w, "[lightgray]" + Stat.reload.localized() + ": [white]" + Strings.autoFixed(60f / weapon.reload * weapon.shots, 1));
sep(w, "[lightgray]" + Stat.targetsAir.localized() + ": [white]" + weapon.bullet.collidesAir);
sep(w, "[lightgray]" + Stat.targetsGround.localized() + ": [white]" + weapon.bullet.collidesGround);
sep(w, "[lightgray]" + Stat.reload.localized() + ": " + (weapon.mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / weapon.reload * weapon.shots, 1));
sep(w, "[lightgray]" + Stat.bullet.localized() + ":");
AmmoListValue bullet = new AmmoListValue(OrderedMap.of(unit, weapon.bullet));