WIP launch pad rework

This commit is contained in:
Anuken
2025-01-31 17:58:35 -05:00
parent bcb7cdae73
commit ab65c9d29a
9 changed files with 136 additions and 47 deletions

View File

@@ -163,31 +163,6 @@ public class Universe{
continue;
}
//first pass: clear import stats
for(Sector sector : planet.sectors){
if(sector.hasBase() && !sector.isBeingPlayed()){
sector.info.lastImported.clear();
}
}
//second pass: update export & import statistics
for(Sector sector : planet.sectors){
if(sector.hasBase() && !sector.isBeingPlayed()){
//export to another sector
if(sector.info.destination != null){
Sector to = sector.info.destination;
if(to.hasBase() && to.planet == planet){
ItemSeq items = new ItemSeq();
//calculated exported items to this sector
sector.info.export.each((item, stat) -> items.add(item, (int)(stat.mean * newSecondsPassed * sector.getProductionScale())));
to.addItems(items);
to.info.lastImported.add(items);
}
}
}
}
//third pass: everything else
for(Sector sector : planet.sectors){
if(sector.hasBase()){
@@ -202,6 +177,8 @@ public class Universe{
//increment seconds passed for this sector by the time that just passed with this turn
if(!sector.isBeingPlayed()){
//TODO: if a planet has sectors under attack and simulation is OFF, just don't simulate it
//increment time if attacked
if(sector.isAttacked()){
sector.info.secondsPassed += turnDuration/60f;
@@ -247,7 +224,8 @@ public class Universe{
sector.info.export.each((item, stat) -> {
if(sector.info.items.get(item) <= 0 && sector.info.production.get(item, ExportStat::new).mean < 0 && stat.mean > 0){
//cap export by import when production is negative.
stat.mean = Math.min(sector.info.lastImported.get(item) / (float)newSecondsPassed, stat.mean);
//TODO remove
stat.mean = Math.min(0f, stat.mean);
}
});