Merge branch 'genNAowl-unit-stats'
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -635,6 +635,8 @@ stat.memorycapacity = Memory Capacity
|
||||
stat.basepowergeneration = Base Power Generation
|
||||
stat.productiontime = Production Time
|
||||
stat.repairtime = Block Full Repair Time
|
||||
stat.weapons = Weapons
|
||||
stat.bullet = Bullet
|
||||
stat.speedincrease = Speed Increase
|
||||
stat.range = Range
|
||||
stat.drilltier = Drillables
|
||||
@@ -704,12 +706,14 @@ units.processorcontrol = [lightgray]Processor Controlled
|
||||
bullet.damage = [stat]{0}[lightgray] damage
|
||||
bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles
|
||||
bullet.incendiary = [stat]incendiary
|
||||
bullet.sapping = [stat]sapping
|
||||
bullet.homing = [stat]homing
|
||||
bullet.shock = [stat]shock
|
||||
bullet.frag = [stat]frag
|
||||
bullet.knockback = [stat]{0}[lightgray] knockback
|
||||
bullet.pierce = [stat]{0}[lightgray]x pierce
|
||||
bullet.infinitepierce = [stat]pierce
|
||||
bullet.healpercent = [stat]{0}[lightgray]% healing
|
||||
bullet.freezing = [stat]freezing
|
||||
bullet.tarred = [stat]tarred
|
||||
bullet.multiplier = [stat]{0}[lightgray]x ammo multiplier
|
||||
|
||||
|
Before Width: | Height: | Size: 917 KiB After Width: | Height: | Size: 944 KiB |
|
Before Width: | Height: | Size: 608 KiB After Width: | Height: | Size: 596 KiB |
|
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 2.9 MiB |
|
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 188 KiB |
@@ -337,6 +337,8 @@ public class UnitTypes implements ContentList{
|
||||
lightningLength = 7;
|
||||
lightningLengthRand = 7;
|
||||
shootEffect = Fx.shootHeal;
|
||||
//Does not actually do anything; Just here to make stats work
|
||||
healPercent = 2f;
|
||||
|
||||
lightningType = new BulletType(0.0001f, 0f){{
|
||||
lifetime = Fx.lightning.lifetime;
|
||||
|
||||
@@ -19,7 +19,8 @@ public class SapBulletType extends BulletType{
|
||||
public SapBulletType(){
|
||||
speed = 0.0001f;
|
||||
despawnEffect = Fx.none;
|
||||
pierce = true;
|
||||
pierce = false;
|
||||
collides = false;
|
||||
hitSize = 0f;
|
||||
hittable = false;
|
||||
hitEffect = Fx.hitLiquid;
|
||||
|
||||
@@ -221,7 +221,7 @@ public class UnitType extends UnlockableContent{
|
||||
stats.add(Stat.canBoost, canBoost);
|
||||
}
|
||||
|
||||
if(inst instanceof Minerc && mineTier >= 1){
|
||||
if(mineTier >= 1){
|
||||
stats.addPercent(Stat.mineSpeed, mineSpeed);
|
||||
stats.add(Stat.mineTier, new BlockFilterValue(b -> b instanceof Floor f && f.itemDrop != null && f.itemDrop.hardness <= mineTier && !f.playerUnmineable));
|
||||
}
|
||||
@@ -231,6 +231,10 @@ public class UnitType extends UnlockableContent{
|
||||
if(inst instanceof Payloadc){
|
||||
stats.add(Stat.payloadCapacity, (payloadCapacity / (tilesize * tilesize)), StatUnit.blocksSquared);
|
||||
}
|
||||
|
||||
if(weapons.any()){
|
||||
stats.add(Stat.weapons, new WeaponListValue(this, weapons));
|
||||
}
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
|
||||
@@ -55,6 +55,9 @@ public enum Stat{
|
||||
linkRange(StatCat.crafting),
|
||||
instructions(StatCat.crafting),
|
||||
|
||||
weapons(StatCat.function),
|
||||
bullet(StatCat.function),
|
||||
|
||||
speedIncrease(StatCat.function),
|
||||
repairTime(StatCat.function),
|
||||
range(StatCat.function),
|
||||
|
||||
@@ -10,6 +10,7 @@ import mindustry.content.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
@@ -26,11 +27,19 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
public void display(Table table){
|
||||
|
||||
table.row();
|
||||
|
||||
for(T t : map.keys()){
|
||||
boolean unit = t instanceof UnitType;
|
||||
|
||||
BulletType type = map.get(t);
|
||||
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||
table.add(t.localizedName).padRight(10).left().top();
|
||||
table.table(Tex.underline, bt -> {
|
||||
|
||||
//no point in displaying unit icon twice
|
||||
if(!unit){
|
||||
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||
table.add(t.localizedName).padRight(10).left().top();
|
||||
}
|
||||
|
||||
table.table(bt -> {
|
||||
bt.left().defaults().padRight(3).left();
|
||||
|
||||
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
|
||||
@@ -41,7 +50,7 @@ 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) && !(type instanceof LiquidBulletType)){
|
||||
if(!unit && !Mathf.equal(type.ammoMultiplier, 1f) && !(type instanceof LiquidBulletType)){
|
||||
sep(bt, Core.bundle.format("bullet.multiplier", (int)type.ammoMultiplier));
|
||||
}
|
||||
|
||||
@@ -53,11 +62,15 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
sep(bt, Core.bundle.format("bullet.knockback", Strings.fixed(type.knockback, 1)));
|
||||
}
|
||||
|
||||
if(type.healPercent > 0f){
|
||||
sep(bt, Core.bundle.format("bullet.healpercent", (int)type.healPercent));
|
||||
}
|
||||
|
||||
if(type.pierce || type.pierceCap != -1){
|
||||
sep(bt, type.pierceCap == -1 ? "@bullet.infinitepierce" : Core.bundle.format("bullet.pierce", type.pierceCap));
|
||||
}
|
||||
|
||||
if((type.status == StatusEffects.burning || type.status == StatusEffects.melting) || type.incendAmount > 0){
|
||||
if(type.status == StatusEffects.burning || type.status == StatusEffects.melting || type.incendAmount > 0){
|
||||
sep(bt, "@bullet.incendiary");
|
||||
}
|
||||
|
||||
@@ -69,6 +82,10 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
sep(bt, "@bullet.tarred");
|
||||
}
|
||||
|
||||
if(type.status == StatusEffects.sapped){
|
||||
sep(bt, "@bullet.sapping");
|
||||
}
|
||||
|
||||
if(type.homingPower > 0.01f){
|
||||
sep(bt, "@bullet.homing");
|
||||
}
|
||||
@@ -80,7 +97,8 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
if(type.fragBullet != null){
|
||||
sep(bt, "@bullet.frag");
|
||||
}
|
||||
}).left().padTop(-9);
|
||||
}).padTop(unit ? 0 : -9).left().get().background(unit ? null : Tex.underline);
|
||||
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
55
core/src/mindustry/world/meta/values/WeaponListValue.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package mindustry.world.meta.values;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
public class WeaponListValue implements StatValue{
|
||||
private final Seq<Weapon> weapons;
|
||||
private final UnitType unit;
|
||||
|
||||
public WeaponListValue(UnitType unit, Seq<Weapon> weapons){
|
||||
this.weapons = weapons;
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Table table){
|
||||
table.row();
|
||||
for(int i = 0;i < weapons.size;i ++){
|
||||
Weapon weapon = weapons.get(i);
|
||||
|
||||
if(weapon.flipSprite){
|
||||
//flipped weapons are not given stats
|
||||
continue;
|
||||
}
|
||||
|
||||
TextureRegion region = weapon.outlineRegion.found() ? weapon.outlineRegion : unit.icon(Cicon.full);
|
||||
|
||||
table.image(region).size(60).scaling(Scaling.bounded).right().top();
|
||||
|
||||
table.table(Tex.underline, w -> {
|
||||
w.left().defaults().padRight(3).left();
|
||||
|
||||
if(weapon.inaccuracy > 0){
|
||||
sep(w, "[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)weapon.inaccuracy + " " + StatUnit.degrees.localized());
|
||||
}
|
||||
sep(w, "[lightgray]" + Stat.reload.localized() + ": " + (weapon.mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / weapon.reload * weapon.shots, 1));
|
||||
|
||||
var bullet = new AmmoListValue<UnitType>(OrderedMap.of(unit, weapon.bullet));
|
||||
bullet.display(w);
|
||||
}).padTop(-9).left();
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
void sep(Table table, String text){
|
||||
table.row();
|
||||
table.add(text);
|
||||
}
|
||||
}
|
||||
@@ -504,7 +504,6 @@ public class Generators{
|
||||
scaled.save(type.name + "-icon-logic");
|
||||
}
|
||||
}
|
||||
|
||||
}catch(IllegalArgumentException e){
|
||||
Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage());
|
||||
}
|
||||
|
||||