Attempt to synchronized logic random seed

This commit is contained in:
Anuken
2021-09-22 20:12:09 -04:00
parent 3f6d5b9dfe
commit 90d1770b3e
6 changed files with 21 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ import mindustry.ctype.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.io.*;
import mindustry.logic.*;
import mindustry.maps.Map;
import mindustry.net.Administration.*;
@@ -41,6 +42,8 @@ public class NetworkIO{
stream.writeInt(state.wave);
stream.writeFloat(state.wavetime);
stream.writeDouble(state.tick);
stream.writeLong(GlobalConstants.rand.seed0);
stream.writeLong(GlobalConstants.rand.seed1);
stream.writeInt(player.id);
player.write(Writes.get(stream));
@@ -63,6 +66,8 @@ public class NetworkIO{
state.wave = stream.readInt();
state.wavetime = stream.readFloat();
state.tick = stream.readDouble();
GlobalConstants.rand.seed0 = stream.readLong();
GlobalConstants.rand.seed1 = stream.readLong();
Groups.clear();
int id = stream.readInt();