Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -383,21 +383,24 @@ public class LandingPad extends Block{
|
|||||||
t.background(Styles.black6);
|
t.background(Styles.black6);
|
||||||
|
|
||||||
t.button(Icon.downOpen, Styles.clearNonei, 40f, () -> {
|
t.button(Icon.downOpen, Styles.clearNonei, 40f, () -> {
|
||||||
if(config != null && state.isCampaign()){
|
if(config == null || !state.isCampaign()) return;
|
||||||
for(Sector sector : state.getPlanet().sectors){
|
|
||||||
if(sector.hasBase() && sector != state.getSector() && sector.info.destination != state.getSector() && sector.info.hasExport(config)){
|
for(Sector sector : state.getPlanet().sectors){
|
||||||
sector.info.destination = state.getSector();
|
if(!canRedirectExports(sector)) continue;
|
||||||
sector.saveInfo();
|
sector.info.destination = state.getSector();
|
||||||
}
|
sector.saveInfo();
|
||||||
}
|
|
||||||
state.getSector().info.refreshImportRates(state.getPlanet());
|
|
||||||
}
|
}
|
||||||
}).disabled(b -> config == null || !state.isCampaign() || (!state.getPlanet().sectors.contains(s -> s.hasBase() && s.info.hasExport(config) && s.info.destination != state.getSector())))
|
state.getSector().info.refreshImportRates(state.getPlanet());
|
||||||
|
}).disabled(button -> config == null || !state.isCampaign() || (!state.getPlanet().sectors.contains(this::canRedirectExports)))
|
||||||
.tooltip("@sectors.redirect").get();
|
.tooltip("@sectors.redirect").get();
|
||||||
}).fillX().left();
|
}).fillX().left();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean canRedirectExports(Sector sector){
|
||||||
|
return sector.hasBase() && sector != state.getSector() && sector.info.hasExport(config) && sector.info.destination != state.getSector();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void display(Table table){
|
public void display(Table table){
|
||||||
super.display(table);
|
super.display(table);
|
||||||
@@ -416,14 +419,13 @@ public class LandingPad extends Block{
|
|||||||
|
|
||||||
int sources = 0;
|
int sources = 0;
|
||||||
float perSecond = 0f;
|
float perSecond = 0f;
|
||||||
for(var s : state.getPlanet().sectors){
|
for(var otherSector : state.getPlanet().sectors){
|
||||||
if(s != state.getSector() && s.hasBase() && s.info.destination == state.getSector()){
|
if(otherSector == state.getSector() || !otherSector.hasBase() || otherSector.info.destination != state.getSector()) continue;
|
||||||
float amount = s.info.getExport(config);
|
|
||||||
if(amount > 0){
|
float amount = otherSector.info.getExport(config);
|
||||||
sources ++;
|
if(amount <= 0) continue;
|
||||||
perSecond += s.info.getExport(config);
|
sources ++;
|
||||||
}
|
perSecond += amount;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String str = Core.bundle.format("landing.sources", sources == 0 ? Core.bundle.get("none") : sources);
|
String str = Core.bundle.format("landing.sources", sources == 0 ? Core.bundle.get("none") : sources);
|
||||||
|
|||||||
Reference in New Issue
Block a user