mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Fixed attack mode gamover check
This commit is contained in:
parent
23673f0b11
commit
436a020c3e
@ -199,19 +199,13 @@ public class Logic implements ApplicationListener{
|
|||||||
state.gameOver = true;
|
state.gameOver = true;
|
||||||
Events.fire(new GameOverEvent(state.rules.waveTeam));
|
Events.fire(new GameOverEvent(state.rules.waveTeam));
|
||||||
}else if(state.rules.attackMode){
|
}else if(state.rules.attackMode){
|
||||||
Team alive = null;
|
//count # of teams alive
|
||||||
|
int countAlive = state.teams.getActive().count(TeamData::hasCore);
|
||||||
|
|
||||||
for(TeamData team : state.teams.getActive()){
|
if((countAlive <= 1 || (!state.rules.pvp && state.rules.defaultTeam.core() == null)) && !state.gameOver){
|
||||||
if(team.hasCore()){
|
//find team that won
|
||||||
if(alive != null){
|
TeamData left = state.teams.getActive().find(TeamData::hasCore);
|
||||||
return;
|
Events.fire(new GameOverEvent(left == null ? Team.derelict : left.team));
|
||||||
}
|
|
||||||
alive = team.team;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(alive != null && !state.gameOver){
|
|
||||||
Events.fire(new GameOverEvent(alive));
|
|
||||||
state.gameOver = true;
|
state.gameOver = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,9 @@ public class MinimapFragment extends Fragment{
|
|||||||
public void toggle(){
|
public void toggle(){
|
||||||
float size = baseSize * zoom * world.width();
|
float size = baseSize * zoom * world.width();
|
||||||
float ratio = (float)renderer.minimap.getTexture().height / renderer.minimap.getTexture().width;
|
float ratio = (float)renderer.minimap.getTexture().height / renderer.minimap.getTexture().width;
|
||||||
panx = (size/2f - player.x() / (world.width() * tilesize) * size) / zoom;
|
float px = player.dead() ? Core.camera.position.x : player.x, py = player.dead() ? Core.camera.position.y : player.y;
|
||||||
pany = (size*ratio/2f - player.y() / (world.height() * tilesize) * size*ratio) / zoom;
|
panx = (size/2f - px / (world.width() * tilesize) * size) / zoom;
|
||||||
|
pany = (size*ratio/2f - py / (world.height() * tilesize) * size*ratio) / zoom;
|
||||||
shown = !shown;
|
shown = !shown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user