mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-01 18:50:27 +03:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1243,7 +1243,7 @@ stat.reactive = Reacts
|
||||
stat.immunities = Immunities
|
||||
stat.healing = Healing
|
||||
stat.status = Status Effect
|
||||
stat.efficiency = [stat]{0}% Efficiency
|
||||
stat.efficiency = {0}% Efficiency
|
||||
stat.chance = [stat]{0}%[lightgray] chance of [white]
|
||||
stat.hitsize = Hitbox Size
|
||||
stat.resettime = Reset Time
|
||||
@@ -1304,6 +1304,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Drill Speed: {0}/s
|
||||
bar.pumpspeed = Pump Speed: {0}/s
|
||||
bar.efficiency = Efficiency: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Batteries: {0}/{1}
|
||||
bar.powerbalance = Power: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Грузаёмістасць Адзінкі Дасягнут
|
||||
bar.drillspeed = Хуткасць бурэння: {0}/с
|
||||
bar.pumpspeed = Хуткасць выкачванне: {0}/с
|
||||
bar.efficiency = Эфектыўнасць: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Моц Узлёту: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Энергія: {0}/с
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Капацитета на преносвачите е дос
|
||||
bar.drillspeed = Скорост на свредлото: {0}/сек
|
||||
bar.pumpspeed = Скорост на помпата: {0}/сек
|
||||
bar.efficiency = Ефективност: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Усилване: +{0}%
|
||||
bar.powerbuffer = Енегрия в батерията: {0}/{1}
|
||||
bar.powerbalance = Енергия: {0}/сек
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = S’ha assolit el límit de càrrega d’unitats.
|
||||
bar.drillspeed = Velocitat de perforació: {0}/s
|
||||
bar.pumpspeed = Velocitat de bombeig: {0}/s
|
||||
bar.efficiency = Eficiència: {0} %
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Potenciador: +{0} %
|
||||
bar.powerbuffer = Energia de la bateria: {0}/{1}
|
||||
bar.powerbalance = Potència: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Strop nákladové jednotky dosažen.
|
||||
bar.drillspeed = Rychlost vrtu: {0}/s
|
||||
bar.pumpspeed = Rychlost pumpy: {0}/s
|
||||
bar.efficiency = Účinnost: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Posílení: +{0}%
|
||||
bar.powerbuffer = Energie v bateriích: {0}/{1}
|
||||
bar.powerbalance = Energie: {0}
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Borehastighed: {0}/s
|
||||
bar.pumpspeed = Pumpehastighed: {0}/s
|
||||
bar.efficiency = Effektivitet: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Strøm: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Frachteinheiten-Limit erreicht
|
||||
bar.drillspeed = Bohrgeschwindigkeit: {0}/s
|
||||
bar.pumpspeed = Pumpengeschwindigkeit: {0}/s
|
||||
bar.efficiency = Effizienz: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Beschleunigung: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Strom: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Se alcanzó el límite de carga de unidades
|
||||
bar.drillspeed = Velocidad del taladro: {0}/s
|
||||
bar.pumpspeed = Velocidad de bombeado: {0}/s
|
||||
bar.efficiency = Eficiencia: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Aceleración: +{0}%
|
||||
bar.powerbuffer = Poder en baterías: {0}/{1}
|
||||
bar.powerbalance = Energía: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Puurimise kiirus: {0}/s
|
||||
bar.pumpspeed = Pump Speed: {0}/s
|
||||
bar.efficiency = Kasutegur: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Bilanss: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Ustiatze-abiadura: {0}/s
|
||||
bar.pumpspeed = Ponpatze abiadura: {0}/s
|
||||
bar.efficiency = Eraginkortasuna: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Bultzada: +{0}%
|
||||
bar.powerbuffer = Bateriaren energia: {0}/{1}
|
||||
bar.powerbalance = Energia: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Kuljetusyksikköjen enimmäismäärä saavutettu
|
||||
bar.drillspeed = Poran nopeus: {0}/s
|
||||
bar.pumpspeed = Pumpun nopeus: {0}/s
|
||||
bar.efficiency = Tehokkuus: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Tehostus: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Energia: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Naabot ng Limit ng Cargo Unit
|
||||
bar.drillspeed = Bilis ng Drill: {0}/s
|
||||
bar.pumpspeed = Bilis ng Pump: {0}/s
|
||||
bar.efficiency = Kahusayan: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Palakas: +{0}%
|
||||
bar.powerbuffer = Battery: {0}/{1}
|
||||
bar.powerbalance = Kuryente: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Limite de Transporteurs Atteinte
|
||||
bar.drillspeed = Vitesse de Forage: {0}/s
|
||||
bar.pumpspeed = Vitesse de Pompage: {0}/s
|
||||
bar.efficiency = Efficacité: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Énergie: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Az egység raktere megtelt
|
||||
bar.drillspeed = Termelés: {0}/mp
|
||||
bar.pumpspeed = Termelés: {0}/mp
|
||||
bar.efficiency = Hatásfok: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Erősítés: +{0}%
|
||||
bar.powerbuffer = Akkumulátorok: {0}/{1}
|
||||
bar.powerbalance = Áram: {0}/mp
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Kapasitas Unit Kargo Telah Mencapai Batas
|
||||
bar.drillspeed = Kecepatan Bor: {0}/d
|
||||
bar.pumpspeed = Kecepatan Pompa: {0}/d
|
||||
bar.efficiency = Efisiensi: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Pendorongan: +{0}%
|
||||
bar.powerbuffer = Tenaga Baterai: {0}/{1}
|
||||
bar.powerbalance = Tenaga: {0}/d
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Limite Unità di Carico Raggiunto
|
||||
bar.drillspeed = Velocità Trivella: {0}/s
|
||||
bar.pumpspeed = Velocità Pompa: {0}/s
|
||||
bar.efficiency = Efficienza: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Potenziamento: +{0}%
|
||||
bar.powerbuffer = Batterie: {0}/{1}
|
||||
bar.powerbalance = Energia: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = 貨物ユニットの容量の上限に達しました
|
||||
bar.drillspeed = 採掘速度: {0}/秒
|
||||
bar.pumpspeed = 吸液速度: {0}/s
|
||||
bar.efficiency = 効率: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = ブースト: +{0}%
|
||||
bar.powerbuffer = バッテリー電力: {0}/{1}
|
||||
bar.powerbalance = 電力均衡: {0}/秒
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = 화물 용량 최대치 도달
|
||||
bar.drillspeed = 드릴 속도: {0}/s
|
||||
bar.pumpspeed = 펌프 속도: {0}/s
|
||||
bar.efficiency = 효율: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = 가속: +{0}%
|
||||
bar.powerbuffer = 배터리 전력: {0}/{1}
|
||||
bar.powerbalance = 전력: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Grąžto Greitis: {0}/s
|
||||
bar.pumpspeed = Pompos Greitis: {0}/s
|
||||
bar.efficiency = Efektyvumas: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Energija: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Vracht eenheid limiet bereikt
|
||||
bar.drillspeed = Delvingssnelheid: {0}/s
|
||||
bar.pumpspeed = Pompsnelheid: {0}/s
|
||||
bar.efficiency = Rendement: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Stroom: {0}
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Drill Speed: {0}/s
|
||||
bar.pumpspeed = Pump Speed: {0}/s
|
||||
bar.efficiency = Efficiency: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Power: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Osiągnieto Limit Ładunku Jednostki
|
||||
bar.drillspeed = Prędkość wiertła: {0}/s
|
||||
bar.pumpspeed = Prędkość pompy: {0}/s
|
||||
bar.efficiency = Efektywność: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Przyspieszenie: +{0}%
|
||||
bar.powerbuffer = Moc baterii: {0}/{1}
|
||||
bar.powerbalance = Moc: {0}
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Limite da carga de unidade atingido
|
||||
bar.drillspeed = Velocidade da Broca: {0}/s
|
||||
bar.pumpspeed = Velocidade da Bomba: {0}/s
|
||||
bar.efficiency = Eficiência: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Impulso: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Energia: {0}
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Limite de Carga Atingido
|
||||
bar.drillspeed = Velocidade da Broca: {0}/s
|
||||
bar.pumpspeed = Velocidade da Bomba: {0}/s
|
||||
bar.efficiency = Eficiência: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Impulso: +{0}%
|
||||
bar.powerbuffer = Batteries: {0}/{1}
|
||||
bar.powerbalance = Energia: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Viteză Minare: {0}/s
|
||||
bar.pumpspeed = Viteză Pompare: {0}/s
|
||||
bar.efficiency = Eficiență: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Efect Grăbire: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Electricitate: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Достигнут предел грузовой единиц
|
||||
bar.drillspeed = Скорость бурения: {0}/с
|
||||
bar.pumpspeed = Скорость выкачивания: {0}/с
|
||||
bar.efficiency = Эффективность: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Ускорение: +{0}%
|
||||
bar.powerbuffer = Энергия в аккумуляторах: {0}/{1}
|
||||
bar.powerbalance = Энергия: {0}/с
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Dostigli Ste Maksimalni Broj Tovarnih Jedinica
|
||||
bar.drillspeed = Brzina Bušenja: {0}/s
|
||||
bar.pumpspeed = Brzina Pumpanja: {0}/s
|
||||
bar.efficiency = Efikasnost: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Pojačanje: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Energija: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Drill Speed: {0}/s
|
||||
bar.pumpspeed = Pump Speed: {0}/s
|
||||
bar.efficiency = Effektivitet: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Power: {0}/s
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = ถึงขีดจำกัดยูนิตขนส่
|
||||
bar.drillspeed = ความเร็วการขุด: {0}/วิ
|
||||
bar.pumpspeed = ความเร็วการปั้ม: {0}/วิ
|
||||
bar.efficiency = ประสิทธิภาพ: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = การเร่ง: +{0}%
|
||||
bar.powerbuffer = พลังงานแบตเตอรี่: {0}/{1}
|
||||
bar.powerbalance = พลังงาน: {0}/วิ
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Cargo Unit Cap Reached
|
||||
bar.drillspeed = Drill Speed: {0}/s
|
||||
bar.pumpspeed = Pump Speed: {0}/s
|
||||
bar.efficiency = Efficiency: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Boost: +{0}%
|
||||
bar.powerbuffer = Battery Power: {0}/{1}
|
||||
bar.powerbalance = Power: {0}
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Kargo Birim Kapasitesine Ulaşıldı
|
||||
bar.drillspeed = Matkap Hızı: {0}/s
|
||||
bar.pumpspeed = Pompa Hızı: {0}/s
|
||||
bar.efficiency = Verim: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Hızlanış: +{0}%
|
||||
bar.powerbuffer = Pil Gücü: {0}/{1}
|
||||
bar.powerbalance = Enerji: {0}/sn
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Досягнуто межі одиниць для ванта
|
||||
bar.drillspeed = Швидкість буріння: {0} за сек.
|
||||
bar.pumpspeed = Швидкість викачування: {0} за сек.
|
||||
bar.efficiency = Ефективність: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Підсилення: +{0}%
|
||||
bar.powerbuffer = Енергія: {0}/{1}
|
||||
bar.powerbalance = Енергія: {0} за сек.
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = Đã đạt tải trọng tối đa
|
||||
bar.drillspeed = Tốc độ khoan: {0}/giây
|
||||
bar.pumpspeed = Tốc độ bơm: {0}/giây
|
||||
bar.efficiency = Hiệu suất: {0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = Tăng tốc: +{0}%
|
||||
bar.powerbuffer = Pin: {0}/{1}
|
||||
bar.powerbalance = Năng lượng: {0}/giây
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = 达到货运单位上限
|
||||
bar.drillspeed = 挖掘速度:{0}/秒
|
||||
bar.pumpspeed = 泵送速度:{0}/秒
|
||||
bar.efficiency = 效率:{0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = 超速:+{0}%
|
||||
bar.powerbuffer = 电池电力:{0}/{1}
|
||||
bar.powerbalance = 电力:{0}/秒
|
||||
|
||||
@@ -1299,6 +1299,7 @@ bar.cargounitcap = 達到單位容量上限
|
||||
bar.drillspeed = 鑽頭速度:{0}/秒
|
||||
bar.pumpspeed = 液體泵送速度:{0}/秒
|
||||
bar.efficiency = 效率:{0}%
|
||||
bar.yield = Yield: +{0}%
|
||||
bar.boost = 速度加成:+{0}%
|
||||
bar.powerbuffer = 蓄電量:{0}/{1}
|
||||
bar.powerbalance = 能量變化:{0}
|
||||
|
||||
@@ -1093,6 +1093,7 @@ public class Blocks{
|
||||
hasLiquids = false;
|
||||
itemCapacity = 30;
|
||||
boostScale = 0.15f;
|
||||
outputScale = 0.15f;
|
||||
drawer = new DrawMulti(new DrawDefault(), new DrawFlame(Color.valueOf("ffef99")));
|
||||
ambientSound = Sounds.loopSmelter;
|
||||
ambientSoundVolume = 0.07f;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.world.blocks.production;
|
||||
|
||||
import arc.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
@@ -11,12 +12,15 @@ import mindustry.world.meta.*;
|
||||
public class AttributeCrafter extends GenericCrafter{
|
||||
public Attribute attribute = Attribute.heat;
|
||||
public float baseEfficiency = 1f;
|
||||
public float boostScale = 1f;
|
||||
public float maxBoost = 1f;
|
||||
public float minEfficiency = -1f;
|
||||
public float displayEfficiencyScale = 1f;
|
||||
public boolean displayEfficiency = true;
|
||||
public boolean displayScaledOutput = true;
|
||||
public boolean scaleLiquidConsumption = false;
|
||||
/** Scaled output (yield) multiplier, scales with attribute. <=0 to disable. */
|
||||
public float outputScale = 0f;
|
||||
/** Scaled efficiency (speed) multiplier, scales with attribute. <=0 to disable. */
|
||||
public float boostScale = 1f;
|
||||
|
||||
public AttributeCrafter(String name){
|
||||
super(name);
|
||||
@@ -26,23 +30,39 @@ public class AttributeCrafter extends GenericCrafter{
|
||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||
super.drawPlace(x, y, rotation, valid);
|
||||
|
||||
if(!displayEfficiency) return;
|
||||
if((!displayEfficiency || boostScale <= 0f) && (!displayScaledOutput || outputScale <= 0f)) return;
|
||||
|
||||
drawPlaceText(Core.bundle.format("bar.efficiency",
|
||||
(int)((baseEfficiency + Math.min(maxBoost, boostScale * sumAttribute(attribute, x, y))) * 100f)), x, y, valid);
|
||||
drawPlaceText(
|
||||
(displayEfficiency && boostScale > 0f ?
|
||||
Core.bundle.format("bar.efficiency",
|
||||
(int)((baseEfficiency + Math.min(maxBoost, boostScale * sumAttribute(attribute, x, y))) * 100f))
|
||||
: "") +
|
||||
(displayScaledOutput && outputScale > 0f ? "\n" +
|
||||
Core.bundle.format("bar.yield",
|
||||
(int)(Math.min(maxBoost, outputScale * sumAttribute(attribute, x, y)) * 100f))
|
||||
: ""), x, y, valid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
if(!displayEfficiency) return;
|
||||
if((!displayEfficiency || boostScale <= 0f) && (!displayScaledOutput || outputScale <= 0f)) return;
|
||||
|
||||
addBar("efficiency", (AttributeCrafterBuild entity) ->
|
||||
if(displayEfficiency && boostScale > 0f){
|
||||
addBar("efficiency", (AttributeCrafterBuild entity) ->
|
||||
new Bar(
|
||||
() -> Core.bundle.format("bar.efficiency", (int)(entity.efficiencyMultiplier() * 100 * displayEfficiencyScale)),
|
||||
() -> Core.bundle.format("bar.efficiency", (int)(entity.efficiencyMultiplier() * 100)),
|
||||
() -> Pal.lightOrange,
|
||||
entity::efficiencyMultiplier));
|
||||
}
|
||||
if(displayScaledOutput && outputScale > 0f){
|
||||
addBar("yield", (AttributeCrafterBuild entity) ->
|
||||
new Bar(
|
||||
() -> Core.bundle.format("bar.yield", (int)((entity.outputMultiplier() - baseEfficiency) * 100)),
|
||||
() -> Pal.lightOrange,
|
||||
entity::outputMultiplier));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,8 +74,12 @@ public class AttributeCrafter extends GenericCrafter{
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(baseEfficiency <= 0.0001f ? Stat.tiles : Stat.affinities, attribute, floating, boostScale * size * size, !displayEfficiency);
|
||||
if(outputScale > 0f){
|
||||
stats.add(baseEfficiency <= 0.0001f ? Stat.tiles :
|
||||
Stat.affinities, attribute, floating, boostScale * size * size, outputScale * size * size, Seq.with(outputItems), craftTime, !displayEfficiency);
|
||||
}else{
|
||||
stats.add(baseEfficiency <= 0.0001f ? Stat.tiles : Stat.affinities, attribute, floating, boostScale * size * size, !displayEfficiency);
|
||||
}
|
||||
}
|
||||
|
||||
public class AttributeCrafterBuild extends GenericCrafterBuild{
|
||||
@@ -66,6 +90,10 @@ public class AttributeCrafter extends GenericCrafter{
|
||||
return super.getProgressIncrease(base) * efficiencyMultiplier();
|
||||
}
|
||||
|
||||
public float outputMultiplier(){
|
||||
return baseEfficiency + Math.min(maxBoost, outputScale * attrsum) + attribute.env();
|
||||
}
|
||||
|
||||
public float efficiencyMultiplier(){
|
||||
return baseEfficiency + Math.min(maxBoost, boostScale * attrsum) + attribute.env();
|
||||
}
|
||||
@@ -75,6 +103,11 @@ public class AttributeCrafter extends GenericCrafter{
|
||||
return scaleLiquidConsumption ? efficiencyMultiplier() : super.efficiencyScale();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float scaleOutput(float amount){
|
||||
return outputScale > 0f ? amount * outputMultiplier() : amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pickedUp(){
|
||||
attrsum = 0f;
|
||||
|
||||
@@ -4,6 +4,7 @@ import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.content.*;
|
||||
@@ -120,6 +121,7 @@ public class GenericCrafter extends Block{
|
||||
if(outputItems == null && outputItem != null){
|
||||
outputItems = new ItemStack[]{outputItem};
|
||||
}
|
||||
|
||||
if(outputLiquids == null && outputLiquid != null){
|
||||
outputLiquids = new LiquidStack[]{outputLiquid};
|
||||
}
|
||||
@@ -139,9 +141,8 @@ public class GenericCrafter extends Block{
|
||||
public void afterPatch(){
|
||||
super.afterPatch();
|
||||
|
||||
outputsLiquid = outputLiquids != null;
|
||||
|
||||
if(outputItems != null) hasItems = true;
|
||||
outputsLiquid = outputLiquids != null;
|
||||
if(outputLiquids != null) hasLiquids = true;
|
||||
}
|
||||
|
||||
@@ -187,6 +188,7 @@ public class GenericCrafter extends Block{
|
||||
public float progress;
|
||||
public float totalProgress;
|
||||
public float warmup;
|
||||
public @Nullable float[] outputAccumulator = outputItems != null && outputItems.length > 0 ? new float[outputItems.length] : null;
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
@@ -203,7 +205,7 @@ public class GenericCrafter extends Block{
|
||||
public boolean shouldConsume(){
|
||||
if(outputItems != null){
|
||||
for(var output : outputItems){
|
||||
if(items.get(output.item) + output.amount > itemCapacity){
|
||||
if(items.get(output.item) + scaleOutput(output.amount) > itemCapacity){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -274,7 +276,7 @@ public class GenericCrafter extends Block{
|
||||
if(outputLiquids != null){
|
||||
max = 0f;
|
||||
for(var s : outputLiquids){
|
||||
float value = (liquidCapacity - liquids.get(s.liquid)) / (s.amount * edelta());
|
||||
float value = (liquidCapacity - liquids.get(s.liquid)) / (scaleOutput(s.amount) * edelta());
|
||||
scaling = Math.min(scaling, value);
|
||||
max = Math.max(max, value);
|
||||
}
|
||||
@@ -298,12 +300,27 @@ public class GenericCrafter extends Block{
|
||||
return totalProgress;
|
||||
}
|
||||
|
||||
/** Allows scaling the crafter's output dynamically. */
|
||||
public float scaleOutput(float amount){
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void craft(){
|
||||
consume();
|
||||
|
||||
if(outputItems != null){
|
||||
for(var output : outputItems){
|
||||
for(int i = 0; i < output.amount; i++){
|
||||
//instantiated here instead of created() because of outputItems runtime changes
|
||||
if(outputAccumulator == null || outputAccumulator.length != outputItems.length){
|
||||
outputAccumulator = new float[outputItems.length];
|
||||
}
|
||||
for(int i = 0; i < outputItems.length; i++){
|
||||
ItemStack output = outputItems[i];
|
||||
|
||||
outputAccumulator[i] += scaleOutput(output.amount);
|
||||
int floored = Mathf.floor(outputAccumulator[i]);
|
||||
outputAccumulator[i] -= floored;
|
||||
|
||||
for(int j = 0; j < floored; j++){
|
||||
offload(output.item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +237,11 @@ public class StatValues{
|
||||
|
||||
/** Displays an item with a specified amount. */
|
||||
private static Stack stack(TextureRegion region, int amount, @Nullable UnlockableContent content, boolean tooltip){
|
||||
return stack(region, (float)amount, content, tooltip);
|
||||
}
|
||||
|
||||
/** Displays an item with a specified amount. */
|
||||
private static Stack stack(TextureRegion region, float amount, @Nullable UnlockableContent content, boolean tooltip){
|
||||
Stack stack = new Stack();
|
||||
|
||||
stack.add(new Table(o -> {
|
||||
@@ -247,7 +252,7 @@ public class StatValues{
|
||||
if(amount != 0){
|
||||
stack.add(new Table(t -> {
|
||||
t.left().bottom();
|
||||
t.add(amount >= 1000 ? UI.formatAmount(amount) : amount + "").name("stack amount").style(Styles.outlineLabel);
|
||||
t.add(amount >= 1000 || Mathf.equal(amount, (int)amount) ? UI.formatAmount((int)amount) : amount + "").name("stack amount").style(Styles.outlineLabel);
|
||||
t.pack();
|
||||
}));
|
||||
}
|
||||
@@ -274,6 +279,10 @@ public class StatValues{
|
||||
return stack(item.uiIcon, amount, item, tooltip);
|
||||
}
|
||||
|
||||
public static Stack stack(UnlockableContent item, float amount, boolean tooltip){
|
||||
return stack(item.uiIcon, amount, item, tooltip);
|
||||
}
|
||||
|
||||
public static Stack stack(Item item){
|
||||
return stack(item.uiIcon, 0, item);
|
||||
}
|
||||
@@ -305,6 +314,13 @@ public class StatValues{
|
||||
return t;
|
||||
}
|
||||
|
||||
public static Table displayItem(Item item, float amount, float timePeriod, boolean showName){
|
||||
Table t = new Table();
|
||||
t.add(stack(item, amount, !showName));
|
||||
t.add((showName ? item.localizedName + "\n" : "") + "[lightgray]" + Strings.autoFixed(amount / (timePeriod / 60f), 3) + StatUnit.perSecond.localized()).padLeft(8).padRight(5).style(Styles.outlineLabel);
|
||||
return t;
|
||||
}
|
||||
|
||||
/** Displays the item with a "/sec" qualifier based on the time period, in ticks. */
|
||||
public static Table displayItemPercent(Item item, int percent, boolean showName){
|
||||
Table t = new Table();
|
||||
@@ -331,6 +347,10 @@ public class StatValues{
|
||||
return blocks(attr, floating, scale, startZero, true);
|
||||
}
|
||||
|
||||
public static StatValue blocks(Attribute attr, boolean floating, float scale1, float scale2, @Nullable Seq<ItemStack> outputs, float timePeriod, boolean startZero){
|
||||
return blocks(attr, floating, scale1, scale2, outputs, timePeriod, startZero, true);
|
||||
}
|
||||
|
||||
public static StatValue blocks(Attribute attr, boolean floating, float scale, boolean startZero, boolean checkFloors){
|
||||
return table -> table.table(c -> {
|
||||
Runnable[] rebuild = {null};
|
||||
@@ -375,6 +395,74 @@ public class StatValues{
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static StatValue blocks(Attribute attr, boolean floating, float scaleEff, float scaleAmount, @Nullable Seq<ItemStack> outputs, float timePeriod, boolean startZero, boolean checkFloors){
|
||||
return table -> {
|
||||
if(table.getCells().size > 0) table.getCells().peek().growX();
|
||||
table.row();
|
||||
|
||||
table.table(c -> {
|
||||
Runnable[] rebuild = {null};
|
||||
Map[] lastMap = {null};
|
||||
|
||||
rebuild[0] = () -> {
|
||||
c.clearChildren();
|
||||
c.left();
|
||||
|
||||
if(state.isGame()){
|
||||
var blocks = Vars.content.blocks()
|
||||
.select(block -> (!checkFloors || block instanceof Floor) && indexer.isBlockPresent(block) && block.attributes.get(attr) != 0 && !((block instanceof Floor f && f.isDeep()) && !floating))
|
||||
.with(s -> s.sort(f -> f.attributes.get(attr)));
|
||||
|
||||
if(blocks.any()){
|
||||
for(var block : blocks){
|
||||
c.table(Styles.grayPanel, b -> {
|
||||
float efficiency = 1f + block.attributes.get(attr) * scaleEff;
|
||||
|
||||
b.image(block.uiIcon).size(40f).pad(10f).left().scaling(Scaling.fit);
|
||||
b.table(center -> {
|
||||
center.left();
|
||||
|
||||
if(outputs != null && outputs.any()){
|
||||
for(ItemStack output : outputs){
|
||||
float scaled = output.amount * (1f + block.attributes.get(attr) * scaleAmount);
|
||||
|
||||
center.table(it -> {
|
||||
it.left();
|
||||
it.add(displayItem(output.item, scaled, timePeriod / efficiency , true)).left().padLeft(6f);
|
||||
}).padRight(8f);
|
||||
}
|
||||
}else{
|
||||
center.add("@none");
|
||||
}
|
||||
}).left().grow();
|
||||
b.add((efficiency < 1f ? "[negstat]" : "[stat]") + Core.bundle.format("stat.efficiency", fixValue(efficiency * 100f))).right().pad(10f).padRight(15f);
|
||||
|
||||
}).growX().pad(5).row();
|
||||
}
|
||||
}else{
|
||||
c.add("@none.inmap");
|
||||
}
|
||||
}else{
|
||||
c.add("@stat.showinmap");
|
||||
}
|
||||
};
|
||||
|
||||
rebuild[0].run();
|
||||
|
||||
//rebuild when map changes.
|
||||
c.update(() -> {
|
||||
Map current = state.isGame() ? state.map : null;
|
||||
|
||||
if(current != lastMap[0]){
|
||||
rebuild[0].run();
|
||||
lastMap[0] = current;
|
||||
}
|
||||
});
|
||||
}).growX().colspan(table.getColumns()).row();
|
||||
};
|
||||
}
|
||||
|
||||
public static StatValue content(Seq<UnlockableContent> list){
|
||||
return content(list, i -> true);
|
||||
}
|
||||
@@ -490,7 +578,7 @@ public class StatValues{
|
||||
c.table(Styles.grayPanel, b -> {
|
||||
b.image(item.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit);
|
||||
b.add(item.localizedName + (timePeriod > 0 ? "\n[lightgray]" + Strings.autoFixed(time, time < 0.01f ? 4 : 2) + StatUnit.perSecond.localized() : "")).left().grow();
|
||||
b.add(Core.bundle.format("stat.efficiency", fixValue(efficiency.get(item) * 100f))).right().pad(10f).padRight(15f);
|
||||
b.add("[stat]" + Core.bundle.format("stat.efficiency", fixValue(efficiency.get(item) * 100f))).right().pad(10f).padRight(15f);
|
||||
}).growX().pad(5).row();
|
||||
}
|
||||
}).growX().colspan(table.getColumns()).row();
|
||||
@@ -505,7 +593,7 @@ public class StatValues{
|
||||
for(Liquid liquid : content.liquids().select(l -> filter.get(l) && l.unlockedNow() && !l.isHidden())){
|
||||
c.table(Styles.grayPanel, b -> {
|
||||
b.add(displayLiquid(liquid, amount, true)).pad(10f).left().grow();
|
||||
b.add(Core.bundle.format("stat.efficiency", fixValue(efficiency.get(liquid) * 100f))).right().pad(10f).padRight(15f);
|
||||
b.add("[stat]" + Core.bundle.format("stat.efficiency", fixValue(efficiency.get(liquid) * 100f))).right().pad(10f).padRight(15f);
|
||||
}).growX().pad(5).row();
|
||||
}
|
||||
}).growX().colspan(table.getColumns()).row();
|
||||
|
||||
@@ -85,6 +85,10 @@ public class Stats{
|
||||
add(stat, StatValues.blocks(attr, floating, scale, startZero));
|
||||
}
|
||||
|
||||
public void add(Stat stat, Attribute attr, boolean floating, float scale1, float scale2, @Nullable Seq<ItemStack> outputs, float timePeriod, boolean startZero){
|
||||
add(stat, StatValues.blocks(attr, floating, scale1, scale2, outputs, timePeriod, startZero));
|
||||
}
|
||||
|
||||
/** Adds a single string value with this stat. */
|
||||
public void add(Stat stat, String format, Object... args){
|
||||
add(stat, StatValues.string(format, args));
|
||||
|
||||
Reference in New Issue
Block a user