mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 19:39:04 +07:00
Bugfixes
This commit is contained in:
parent
47e723c557
commit
fd69241de9
@ -405,13 +405,18 @@ public class NetServer implements ApplicationListener{
|
||||
return;
|
||||
}
|
||||
|
||||
if(player.con.hasConnected){
|
||||
Events.fire(new PlayerLeave(player));
|
||||
Call.sendMessage("[accent]" + player.name + "[accent] has disconnected.");
|
||||
Call.onPlayerDisconnect(player.id);
|
||||
if(!player.con.hasDisconnected){
|
||||
if(player.con.hasConnected){
|
||||
Events.fire(new PlayerLeave(player));
|
||||
Call.sendMessage("[accent]" + player.name + "[accent] has disconnected.");
|
||||
Call.onPlayerDisconnect(player.id);
|
||||
}
|
||||
|
||||
Log.info("&lm[{1}] &lc{0} has disconnected. &lg&fi({2})", player.name, player.uuid, reason);
|
||||
}
|
||||
|
||||
player.remove();
|
||||
Log.info("&lm[{1}] &lc{0} has disconnected. &lg&fi({2})", player.name, player.uuid, reason);
|
||||
player.con.hasDisconnected = true;
|
||||
}
|
||||
|
||||
private static float compound(float speed, float drag){
|
||||
@ -709,7 +714,12 @@ public class NetServer implements ApplicationListener{
|
||||
//iterate through each player
|
||||
for(int i = 0; i < playerGroup.size(); i++){
|
||||
Player player = playerGroup.all().get(i);
|
||||
if(player.isLocal || player.con == null) continue;
|
||||
if(player.isLocal) continue;
|
||||
|
||||
if(player.con == null || !player.con.isConnected()){
|
||||
onDisconnect(player, "disappeared");
|
||||
continue;
|
||||
}
|
||||
|
||||
NetConnection connection = player.con;
|
||||
|
||||
|
@ -22,7 +22,7 @@ public abstract class NetConnection{
|
||||
/** Timestamp of last recieved snapshot. */
|
||||
public long lastRecievedClientTime;
|
||||
|
||||
public boolean hasConnected, hasBegunConnecting;
|
||||
public boolean hasConnected, hasBegunConnecting, hasDisconnected;
|
||||
public float viewWidth, viewHeight, viewX, viewY;
|
||||
|
||||
public NetConnection(String address){
|
||||
|
@ -151,20 +151,24 @@ public class ServerControl implements ApplicationListener{
|
||||
|
||||
if(Core.settings.getBool("shuffle")){
|
||||
if(maps.all().size > 0){
|
||||
Array<Map> maps = Vars.maps.customMaps().size == 0 ? Vars.maps.defaultMaps() : Vars.maps.customMaps();
|
||||
Array<Map> maps = Array.with(Vars.maps.customMaps().size == 0 ? Vars.maps.defaultMaps() : Vars.maps.customMaps());
|
||||
maps.shuffle();
|
||||
|
||||
Map previous = world.getMap();
|
||||
Map map = maps.random(previous);
|
||||
Map map = maps.find(m -> lastMode.valid(m) && m != previous);
|
||||
|
||||
Call.onInfoMessage((state.rules.pvp
|
||||
? "[YELLOW]The " + event.winner.name() + " team is victorious![]" : "[SCARLET]Game over![]")
|
||||
+ "\nNext selected map:[accent] " + map.name() + "[]"
|
||||
+ (map.tags.containsKey("author") && !map.tags.get("author").trim().isEmpty() ? " by[accent] " + map.author() + "[]" : "") + "." +
|
||||
"\nNew game begins in " + roundExtraTime + "[] seconds.");
|
||||
if(map != null){
|
||||
|
||||
info("Selected next map to be {0}.", map.name());
|
||||
Call.onInfoMessage((state.rules.pvp
|
||||
? "[YELLOW]The " + event.winner.name() + " team is victorious![]" : "[SCARLET]Game over![]")
|
||||
+ "\nNext selected map:[accent] " + map.name() + "[]"
|
||||
+ (map.tags.containsKey("author") && !map.tags.get("author").trim().isEmpty() ? " by[accent] " + map.author() + "[]" : "") + "." +
|
||||
"\nNew game begins in " + roundExtraTime + "[] seconds.");
|
||||
|
||||
play(true, () -> world.loadMap(map, map.applyRules(lastMode)));
|
||||
info("Selected next map to be {0}.", map.name());
|
||||
|
||||
play(true, () -> world.loadMap(map, map.applyRules(lastMode)));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
netServer.kickAll(KickReason.gameover);
|
||||
@ -813,6 +817,8 @@ public class ServerControl implements ApplicationListener{
|
||||
state.rules = world.getMap().applyRules(lastMode);
|
||||
|
||||
for(Player p : players){
|
||||
if(p.con == null) continue;
|
||||
|
||||
p.reset();
|
||||
if(state.rules.pvp){
|
||||
p.setTeam(netServer.assignTeam(p, new ArrayIterable<>(players)));
|
||||
|
Loading…
Reference in New Issue
Block a user