Turn logic / Cross-sector production / Pad tweaks
This commit is contained in:
@@ -3,6 +3,7 @@ package mindustry.io;
|
||||
import arc.struct.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.maps.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
import static mindustry.Vars.maps;
|
||||
|
||||
@@ -16,8 +17,11 @@ public class SaveMeta{
|
||||
public Rules rules;
|
||||
public StringMap tags;
|
||||
public String[] mods;
|
||||
/** These are in items/second. */
|
||||
public ObjectFloatMap<Item> productionRates;
|
||||
public boolean hasProduction;
|
||||
|
||||
public SaveMeta(int version, long timestamp, long timePlayed, int build, String map, int wave, Rules rules, StringMap tags){
|
||||
public SaveMeta(int version, long timestamp, long timePlayed, int build, String map, int wave, Rules rules, ObjectFloatMap<Item> productionRates, StringMap tags){
|
||||
this.version = version;
|
||||
this.build = build;
|
||||
this.timestamp = timestamp;
|
||||
@@ -27,5 +31,8 @@ public class SaveMeta{
|
||||
this.rules = rules;
|
||||
this.tags = tags;
|
||||
this.mods = JsonIO.read(String[].class, tags.get("mods", "[]"));
|
||||
this.productionRates = productionRates;
|
||||
|
||||
productionRates.each(e -> hasProduction |= e.value > 0.001f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,17 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
public SaveMeta getMeta(DataInput stream) throws IOException{
|
||||
stream.readInt(); //length of data, doesn't matter here
|
||||
StringMap map = readStringMap(stream);
|
||||
return new SaveMeta(map.getInt("version"), map.getLong("saved"), map.getLong("playtime"), map.getInt("build"), map.get("mapname"), map.getInt("wave"), JsonIO.read(Rules.class, map.get("rules", "{}")), map);
|
||||
return new SaveMeta(
|
||||
map.getInt("version"),
|
||||
map.getLong("saved"),
|
||||
map.getLong("playtime"),
|
||||
map.getInt("build"),
|
||||
map.get("mapname"),
|
||||
map.getInt("wave"),
|
||||
JsonIO.read(Rules.class, map.get("rules", "{}")),
|
||||
JsonIO.read(Stats.class, map.get("stats", "{}")).productionRates(),
|
||||
map
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user