mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 06:22:17 -08:00
Fix many things
This commit is contained in:
parent
3a27e6e94e
commit
4d3c6879b5
5 changed files with 18 additions and 42 deletions
|
|
@ -629,7 +629,6 @@ stat.basepowergeneration = Base Power Generation
|
|||
stat.productiontime = Production Time
|
||||
stat.repairtime = Block Full Repair Time
|
||||
stat.weapons = Weapons
|
||||
stat.mirrored = Mirrored
|
||||
stat.bullet = Bullet
|
||||
stat.speedincrease = Speed Increase
|
||||
stat.range = Range
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ public enum Stat{
|
|||
instructions(StatCat.crafting),
|
||||
|
||||
weapons(StatCat.function),
|
||||
mirrored(StatCat.function),
|
||||
bullet(StatCat.function),
|
||||
|
||||
speedIncrease(StatCat.function),
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -504,38 +504,6 @@ public class Generators{
|
|||
scaled.save(type.name + "-icon-logic");
|
||||
}
|
||||
}
|
||||
|
||||
//generate weapon stat UI
|
||||
|
||||
//largest side calculated here to prevent sprite squishing
|
||||
int largestSide = Math.max(image.width, image.height);
|
||||
Image base = new Image(largestSide, largestSide);
|
||||
|
||||
image.each((x, y) -> {
|
||||
int newX = x - image.width/2 + base.width/2;
|
||||
int newY = y - image.height/2 + base.height/2;
|
||||
Color c = image.getColor(x, y);
|
||||
base.draw(newX, newY, c.set(c.r, c.g, c.b, c.a * 0.2f));
|
||||
});
|
||||
|
||||
for(int i = 0;i < type.weapons.size;i ++){
|
||||
Weapon weapon = type.weapons.get(i);
|
||||
|
||||
if(weapon.flipSprite){
|
||||
//fliped weapons are not given stats
|
||||
continue;
|
||||
}
|
||||
|
||||
weapon.load();
|
||||
Image baseWithWeapon = base.copy();
|
||||
|
||||
baseWithWeapon.draw(outline.get(ImagePacker.get(weapon.region)),
|
||||
(int)(weapon.x / Draw.scl + base.width / 2f - weapon.region.width / 2f),
|
||||
(int)(-weapon.y / Draw.scl + base.height / 2f - weapon.region.height / 2f),
|
||||
weapon.flipSprite, false);
|
||||
|
||||
baseWithWeapon.save(type.name + "-weapon" + i);
|
||||
}
|
||||
}catch(IllegalArgumentException e){
|
||||
Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue