Merge branch 'master' into port-field

This commit is contained in:
Antsiferov Andrew
2021-01-01 21:55:19 +03:00
committed by GitHub
1246 changed files with 30340 additions and 60705 deletions

View File

@@ -1,10 +1,12 @@
package mindustry.net;
import arc.Core;
import arc.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.io.*;
@@ -22,6 +24,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);