Fix many things
This commit is contained in:
@@ -629,7 +629,6 @@ stat.basepowergeneration = Base Power Generation
|
|||||||
stat.productiontime = Production Time
|
stat.productiontime = Production Time
|
||||||
stat.repairtime = Block Full Repair Time
|
stat.repairtime = Block Full Repair Time
|
||||||
stat.weapons = Weapons
|
stat.weapons = Weapons
|
||||||
stat.mirrored = Mirrored
|
|
||||||
stat.bullet = Bullet
|
stat.bullet = Bullet
|
||||||
stat.speedincrease = Speed Increase
|
stat.speedincrease = Speed Increase
|
||||||
stat.range = Range
|
stat.range = Range
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public enum Stat{
|
|||||||
instructions(StatCat.crafting),
|
instructions(StatCat.crafting),
|
||||||
|
|
||||||
weapons(StatCat.function),
|
weapons(StatCat.function),
|
||||||
mirrored(StatCat.function),
|
|
||||||
bullet(StatCat.function),
|
bullet(StatCat.function),
|
||||||
|
|
||||||
speedIncrease(StatCat.function),
|
speedIncrease(StatCat.function),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mindustry.world.meta.values;
|
package mindustry.world.meta.values;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.func.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
@@ -29,11 +30,12 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
|||||||
table.row();
|
table.row();
|
||||||
for(T t : map.keys()){
|
for(T t : map.keys()){
|
||||||
BulletType type = map.get(t);
|
BulletType type = map.get(t);
|
||||||
|
//no point in displaying unit icon twice
|
||||||
if(!(t instanceof UnitType)){
|
if(!(t instanceof UnitType)){
|
||||||
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||||
table.add(t.localizedName).padRight(10).left().top();
|
table.add(t.localizedName).padRight(10).left().top();
|
||||||
}
|
}
|
||||||
table.table(Tex.underline, bt -> {
|
Cons<Table> tableCons = bt -> {
|
||||||
bt.left().defaults().padRight(3).left();
|
bt.left().defaults().padRight(3).left();
|
||||||
|
|
||||||
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
|
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)));
|
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));
|
sep(bt, Core.bundle.format("bullet.multiplier", (int)type.ammoMultiplier));
|
||||||
if(!Mathf.equal(type.reloadMultiplier, 1f))
|
if(!Mathf.equal(type.reloadMultiplier, 1f))
|
||||||
sep(bt, Core.bundle.format("bullet.reload", Strings.fixed(type.reloadMultiplier, 1)));
|
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){
|
if(type.fragBullet != null){
|
||||||
sep(bt, "@bullet.frag");
|
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();
|
table.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import arc.scene.ui.layout.*;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
import mindustry.ui.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -30,15 +31,16 @@ public class WeaponListValue implements StatValue{
|
|||||||
continue;
|
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 -> {
|
table.table(Tex.underline, w -> {
|
||||||
w.left().defaults().padRight(3).left();
|
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.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.reload.localized() + ": " + (weapon.mirror ? "2x " : "") + "[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.bullet.localized() + ":");
|
sep(w, "[lightgray]" + Stat.bullet.localized() + ":");
|
||||||
|
|
||||||
AmmoListValue bullet = new AmmoListValue(OrderedMap.of(unit, weapon.bullet));
|
AmmoListValue bullet = new AmmoListValue(OrderedMap.of(unit, weapon.bullet));
|
||||||
|
|||||||
@@ -504,38 +504,6 @@ public class Generators{
|
|||||||
scaled.save(type.name + "-icon-logic");
|
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){
|
}catch(IllegalArgumentException e){
|
||||||
Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage());
|
Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user