too many things to list

This commit is contained in:
Anuken
2020-10-15 13:44:20 -04:00
parent fb0179da95
commit 86c2fe8805
52 changed files with 665 additions and 117 deletions

View File

@@ -3,7 +3,9 @@ package mindustry.net;
import arc.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.io.*;
@@ -21,6 +23,18 @@ public class NetworkIO{
public static void writeWorld(Player player, OutputStream os){
try(DataOutputStream stream = new DataOutputStream(os)){
//write all researched content to rules if hosting
if(state.isCampaign()){
state.rules.researched.clear();
for(ContentType type : ContentType.all){
for(Content c : content.getBy(type)){
if(c instanceof UnlockableContent u && u.unlocked() && TechTree.get(u) != null){
state.rules.researched.add(u.name);
}
}
}
}
stream.writeUTF(JsonIO.write(state.rules));
SaveIO.getSaveWriter().writeStringMap(stream, state.map.tags);
@@ -44,6 +58,8 @@ public class NetworkIO{
state.rules = JsonIO.read(Rules.class, stream.readUTF());
state.map = new Map(SaveIO.getSaveWriter().readStringMap(stream));
Log.info("READ RULES: @", state.rules.researched);
state.wave = stream.readInt();
state.wavetime = stream.readFloat();