Fixed incorrect game-overs on zone attack maps

This commit is contained in:
Anuken 2019-06-29 11:02:27 -04:00
parent 04dfda0c55
commit 576f0be4ab
3 changed files with 16 additions and 6 deletions

View File

@ -15,6 +15,7 @@ import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.game.Teams.TeamData;
import io.anuke.mindustry.gen.BrokenBlock;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.world.Block;
@ -130,8 +131,13 @@ public class Logic implements ApplicationListener{
}
if(alive != null && !state.gameOver){
if(world.isZone() && alive == defaultTeam){
//in attack maps, a victorious game over is equivalent to a launch
Call.launchZone();
}else{
Events.fire(new GameOverEvent(alive));
}
state.gameOver = true;
Events.fire(new GameOverEvent(alive));
}
}
}
@ -154,6 +160,9 @@ public class Logic implements ApplicationListener{
world.removeBlock(tile);
}
state.launched = true;
state.gameOver = true;
//manually fire game over event now
Events.fire(new GameOverEvent(defaultTeam));
});
}

View File

@ -121,7 +121,8 @@ public class Zone extends UnlockableContent{
/** Whether this zone has met its condition; if true, the player can leave. */
public boolean metCondition(){
return state.wave >= conditionWave;
//players can't leave in attack mode.
return state.wave >= conditionWave && !state.rules.attackMode;
}
public boolean canConfigure(){

View File

@ -359,10 +359,10 @@ public class HudFragment extends Fragment{
button.getStyle().disabledFontColor = Color.WHITE;
button.margin(16f);
button.visible(() ->
world.isZone() &&
world.getZone().metCondition() &&
!Net.client() &&
state.wave % world.getZone().launchPeriod == 0 && !world.spawner.isSpawning());
world.isZone() &&
world.getZone().metCondition() &&
!Net.client() &&
state.wave % world.getZone().launchPeriod == 0 && !world.spawner.isSpawning());
button.update(() -> {
if(world.getZone() == null){