campaign progress
This commit is contained in:
@@ -24,7 +24,7 @@ public class SectorInfo{
|
||||
/** Export statistics. */
|
||||
public ObjectMap<Item, ExportStat> export = new ObjectMap<>();
|
||||
/** Items stored in all cores. */
|
||||
public ObjectIntMap<Item> coreItems = new ObjectIntMap<>();
|
||||
public ItemSeq coreItems = new ItemSeq();
|
||||
/** The best available core type. */
|
||||
public Block bestCoreType = Blocks.air;
|
||||
/** Max storage capacity. */
|
||||
@@ -80,7 +80,7 @@ public class SectorInfo{
|
||||
if(entity != null){
|
||||
ItemModule items = entity.items;
|
||||
for(int i = 0; i < items.length(); i++){
|
||||
coreItems.put(content.item(i), items.get(i));
|
||||
coreItems.set(content.item(i), items.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SectorInfo{
|
||||
bestCoreType = !hasCore ? Blocks.air : state.rules.defaultTeam.cores().max(e -> e.block.size).block;
|
||||
storageCapacity = entity != null ? entity.storageCapacity : 0;
|
||||
|
||||
//update sector's internal time spent counter1
|
||||
//update sector's internal time spent counter
|
||||
state.rules.sector.setTimeSpent(internalTimeSpent);
|
||||
}
|
||||
|
||||
@@ -100,6 +100,12 @@ public class SectorInfo{
|
||||
|
||||
internalTimeSpent += Time.delta;
|
||||
|
||||
//autorun turns
|
||||
if(internalTimeSpent >= turnDuration){
|
||||
internalTimeSpent = 0;
|
||||
universe.runTurn();
|
||||
}
|
||||
|
||||
//create last stored core items
|
||||
if(lastCoreItems == null){
|
||||
lastCoreItems = new int[content.items().size];
|
||||
|
||||
@@ -5,7 +5,6 @@ import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
@@ -54,25 +53,9 @@ public class Universe{
|
||||
}
|
||||
}
|
||||
|
||||
public void displayTimeEnd(){
|
||||
if(!headless){
|
||||
//check if any sectors are under attack to display this
|
||||
Seq<Sector> attacked = state.getSector().planet.sectors.select(s -> s.hasWaves() && s.hasBase() && !s.isBeingPlayed() && s.getSecondsPassed() > 1);
|
||||
|
||||
if(attacked.any()){
|
||||
state.set(State.paused);
|
||||
|
||||
//TODO localize
|
||||
String text = attacked.size > 1 ? attacked.size + " sectors attacked." : "Sector " + attacked.first().id + " under attack.";
|
||||
|
||||
ui.hudfrag.sectorText = text;
|
||||
ui.hudfrag.attackedSectors = attacked;
|
||||
ui.announce(text);
|
||||
}else{
|
||||
//autorun next turn
|
||||
universe.runTurn();
|
||||
}
|
||||
}
|
||||
/** @return sectors attacked on the current planet, minus the ones that are being played on right now. */
|
||||
public Seq<Sector> getAttacked(Planet planet){
|
||||
return planet.sectors.select(s -> s.hasWaves() && s.hasBase() && !s.isBeingPlayed() && s.getSecondsPassed() > 1);
|
||||
}
|
||||
|
||||
/** Update planet rotations, global time and relevant state. */
|
||||
|
||||
Reference in New Issue
Block a user