mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-09 15:27:45 +07:00
Fixed game-over state / Recipe balance
This commit is contained in:
@ -45,6 +45,7 @@ public class ServerControl extends Module{
|
||||
private ShuffleMode mode;
|
||||
private int gameOvers;
|
||||
private boolean inExtraRound;
|
||||
private Team winnerTeam;
|
||||
|
||||
public ServerControl(String[] args){
|
||||
Settings.defaultList(
|
||||
@ -106,7 +107,9 @@ public class ServerControl extends Module{
|
||||
while(map == previous) map = maps.random();
|
||||
}
|
||||
|
||||
Call.onInfoMessage("[SCARLET]Game over![]\nNext selected map:[accent] "+map.name+"[]"
|
||||
Call.onInfoMessage((state.mode.isPvp && winnerTeam != null
|
||||
? "[YELLOW]The " + winnerTeam.name() + " team is victorious![]" : "[SCARLET]Game over![]")
|
||||
+ "\nNext selected map:[accent] "+map.name+"[]"
|
||||
+ (map.meta.author() != null ? " by[accent] " + map.meta.author() + "[]" : "") + "."+
|
||||
"\nNew game begins in " + roundExtraTime + " seconds.");
|
||||
|
||||
@ -901,6 +904,25 @@ public class ServerControl extends Module{
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPvPGameOver(){
|
||||
Team alive = null;
|
||||
|
||||
for(Team team : Team.all){
|
||||
if(state.teams.get(team).cores.size > 0){
|
||||
if(alive != null){
|
||||
return;
|
||||
}
|
||||
alive = team;
|
||||
}
|
||||
}
|
||||
|
||||
if(alive != null && !state.gameOver){
|
||||
state.gameOver = true;
|
||||
winnerTeam = alive;
|
||||
Events.fire(GameOverEvent.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
|
||||
|
Reference in New Issue
Block a user