mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 23:38:10 +07:00
This commit is contained in:
@ -566,6 +566,7 @@ sectors.unexplored = [lightgray]Unexplored
|
|||||||
sectors.resources = Resources:
|
sectors.resources = Resources:
|
||||||
sectors.production = Production:
|
sectors.production = Production:
|
||||||
sectors.export = Export:
|
sectors.export = Export:
|
||||||
|
sectors.import = Import:
|
||||||
sectors.time = Time:
|
sectors.time = Time:
|
||||||
sectors.threat = Threat:
|
sectors.threat = Threat:
|
||||||
sectors.wave = Wave:
|
sectors.wave = Wave:
|
||||||
|
@ -117,11 +117,6 @@ public class SectorInfo{
|
|||||||
export.get(item, ExportStat::new).counter += amount;
|
export.get(item, ExportStat::new).counter += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Subtracts from export statistics. */
|
|
||||||
public void handleItemImport(Item item, int amount){
|
|
||||||
export.get(item, ExportStat::new).counter -= amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getExport(Item item){
|
public float getExport(Item item){
|
||||||
return export.get(item, ExportStat::new).mean;
|
return export.get(item, ExportStat::new).mean;
|
||||||
}
|
}
|
||||||
@ -270,6 +265,26 @@ public class SectorInfo{
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** @return a newly allocated map with import statistics. Use sparingly. */
|
||||||
|
public ObjectMap<Item, ExportStat> importStats(){
|
||||||
|
//build empty import stats
|
||||||
|
ObjectMap<Item, ExportStat> imports = new ObjectMap<>();
|
||||||
|
//for all sectors on all planets that have bases and export to this sector
|
||||||
|
for(Planet planet : content.planets()){
|
||||||
|
for(Sector sector : planet.sectors){
|
||||||
|
Sector dest = sector.info.getRealDestination();
|
||||||
|
if(sector.hasBase() && sector.info != this && dest != null && dest.info == this){
|
||||||
|
//add their exports to our imports
|
||||||
|
sector.info.export.each((item, stat) -> {
|
||||||
|
imports.get(item, ExportStat::new).mean += stat.mean;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return imports;
|
||||||
|
}
|
||||||
|
|
||||||
public static class ExportStat{
|
public static class ExportStat{
|
||||||
public transient float counter;
|
public transient float counter;
|
||||||
public transient WindowedMean means = new WindowedMean(valueWindow);
|
public transient WindowedMean means = new WindowedMean(valueWindow);
|
||||||
|
@ -614,7 +614,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
|
|
||||||
int[] i = {0};
|
int[] i = {0};
|
||||||
|
|
||||||
stats.each((item, stat) -> {
|
for(var item : content.items()){
|
||||||
|
var stat = stats.get(item);
|
||||||
|
if(stat == null) continue;
|
||||||
int total = (int)(stat.mean * 60 * scl);
|
int total = (int)(stat.mean * 60 * scl);
|
||||||
if(total > 1){
|
if(total > 1){
|
||||||
t.image(item.uiIcon).padRight(3);
|
t.image(item.uiIcon).padRight(3);
|
||||||
@ -623,7 +625,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
t.row();
|
t.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
if(t.getChildren().any()){
|
if(t.getChildren().any()){
|
||||||
c.add(name).left().row();
|
c.add(name).left().row();
|
||||||
@ -658,6 +660,11 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
//export
|
//export
|
||||||
display.get(sector.info.export, "@sectors.export");
|
display.get(sector.info.export, "@sectors.export");
|
||||||
|
|
||||||
|
//import
|
||||||
|
if(sector.hasBase()){
|
||||||
|
display.get(sector.info.importStats(), "@sectors.import");
|
||||||
|
}
|
||||||
|
|
||||||
ItemSeq items = sector.items();
|
ItemSeq items = sector.items();
|
||||||
|
|
||||||
//stored resources
|
//stored resources
|
||||||
|
@ -115,10 +115,6 @@ public class LaunchPad extends Block{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
float cooldown = Mathf.clamp(launchCounter / (90f));
|
|
||||||
|
|
||||||
Draw.mixcol(lightColor, 1f - cooldown);
|
|
||||||
|
|
||||||
Draw.rect(podRegion, x, y);
|
Draw.rect(podRegion, x, y);
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
Reference in New Issue
Block a user