Added delay after game-over to prevent SocketInUse error

This commit is contained in:
Anuken
2018-02-11 19:38:03 -05:00
parent 4311e57dd7
commit 3f8e6e85bd
2 changed files with 17 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Sun Feb 11 17:04:14 EST 2018 #Sun Feb 11 19:23:12 EST 2018
version=beta version=beta
androidBuildCode=172 androidBuildCode=173
name=Mindustry name=Mindustry
code=3.3 code=3.3
build=custom build build=custom build

View File

@@ -71,20 +71,23 @@ public class ServerControl extends Module {
state.set(State.menu); state.set(State.menu);
Net.closeServer(); Net.closeServer();
if(mode != ShuffleMode.off) { Timers.runTask(30f, () -> {
Array<Map> maps = mode == ShuffleMode.both ? world.maps().getAllMaps() :
mode == ShuffleMode.normal ? world.maps().getDefaultMaps() : world.maps().getCustomMaps();
Map previous = world.getMap(); if (mode != ShuffleMode.off) {
Map map = previous; Array<Map> maps = mode == ShuffleMode.both ? world.maps().getAllMaps() :
while(map == previous || !map.visible) map = maps.random(); mode == ShuffleMode.normal ? world.maps().getDefaultMaps() : world.maps().getCustomMaps();
info("Selected next map to be {0}.", map.name); Map previous = world.getMap();
state.set(State.playing); Map map = previous;
logic.reset(); while (map == previous || !map.visible) map = maps.random();
world.loadMap(map);
host(); info("Selected next map to be {0}.", map.name);
} state.set(State.playing);
logic.reset();
world.loadMap(map);
host();
}
});
}); });
}); });