Global sector items / Mod file reading
This commit is contained in:
@@ -140,17 +140,6 @@ public class SectorInfo{
|
||||
}
|
||||
}
|
||||
|
||||
/** @return the items in this sector now, taking into account production and items received. */
|
||||
public ObjectIntMap<Item> getCurrentItems(Sector sector){
|
||||
ObjectIntMap<Item> map = new ObjectIntMap<>();
|
||||
map.putAll(coreItems);
|
||||
long seconds = sector.getSecondsPassed();
|
||||
production.each((item, stat) -> map.increment(item, (int)(stat.mean * seconds)));
|
||||
//increment based on received items
|
||||
sector.getReceivedItems().each(stack -> map.increment(stack.item, stack.amount));
|
||||
return map;
|
||||
}
|
||||
|
||||
private void updateCoreDeltas(){
|
||||
CoreEntity ent = state.rules.defaultTeam.core();
|
||||
for(int i = 0; i < lastCoreItems.length; i++){
|
||||
|
||||
@@ -163,6 +163,21 @@ public class Universe{
|
||||
save();
|
||||
}
|
||||
|
||||
/** This method is expensive to call; only do so sparingly. */
|
||||
public ItemSeq getGlobalResources(){
|
||||
ItemSeq count = new ItemSeq();
|
||||
|
||||
for(Planet planet : content.planets()){
|
||||
for(Sector sector : planet.sectors){
|
||||
if(sector.hasSave()){
|
||||
count.add(sector.calculateItems());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public float secondsMod(float mod, float scale){
|
||||
return (seconds / scale) % mod;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user