Research system progress
This commit is contained in:
@@ -6,6 +6,7 @@ import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.content.TechTree.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.*;
|
||||
@@ -75,6 +76,11 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
state.secinfo.prepare();
|
||||
}
|
||||
|
||||
//flush tech node progress
|
||||
for(TechNode node : TechTree.all){
|
||||
node.save();
|
||||
}
|
||||
|
||||
writeStringMap(stream, StringMap.of(
|
||||
"saved", Time.millis(),
|
||||
"playtime", headless ? 0 : control.saves.getTotalPlaytime(),
|
||||
|
||||
@@ -7,6 +7,8 @@ import arc.util.io.*;
|
||||
import arc.util.pooling.*;
|
||||
import mindustry.ai.types.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.content.TechTree.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.entities.units.*;
|
||||
@@ -67,6 +69,11 @@ public class TypeIO{
|
||||
for(int i = 0; i < ((Point2[])object).length; i++){
|
||||
write.i(((Point2[])object)[i].pack());
|
||||
}
|
||||
}else if(object instanceof TechNode){
|
||||
TechNode map = (TechNode)object;
|
||||
write.b(9);
|
||||
write.b((byte)map.content.getContentType().ordinal());
|
||||
write.s(map.content.id);
|
||||
}else{
|
||||
throw new IllegalArgumentException("Unknown object type: " + object.getClass());
|
||||
}
|
||||
@@ -84,6 +91,7 @@ public class TypeIO{
|
||||
case 6: short length = read.s(); IntSeq arr = new IntSeq(); for(int i = 0; i < length; i ++) arr.add(read.i()); return arr;
|
||||
case 7: return new Point2(read.i(), read.i());
|
||||
case 8: byte len = read.b(); Point2[] out = new Point2[len]; for(int i = 0; i < len; i ++) out[i] = Point2.unpack(read.i()); return out;
|
||||
case 9: return TechTree.getNotNull(content.getByID(ContentType.all[read.b()], read.s()));
|
||||
default: throw new IllegalArgumentException("Unknown object type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user