mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Fixed incorrect game-overs on zone attack maps
This commit is contained in:
parent
04dfda0c55
commit
576f0be4ab
@ -15,6 +15,7 @@ import io.anuke.mindustry.game.EventType.*;
|
|||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.game.Teams.TeamData;
|
import io.anuke.mindustry.game.Teams.TeamData;
|
||||||
import io.anuke.mindustry.gen.BrokenBlock;
|
import io.anuke.mindustry.gen.BrokenBlock;
|
||||||
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
@ -130,8 +131,13 @@ public class Logic implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(alive != null && !state.gameOver){
|
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;
|
state.gameOver = true;
|
||||||
Events.fire(new GameOverEvent(alive));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,6 +160,9 @@ public class Logic implements ApplicationListener{
|
|||||||
world.removeBlock(tile);
|
world.removeBlock(tile);
|
||||||
}
|
}
|
||||||
state.launched = true;
|
state.launched = true;
|
||||||
|
state.gameOver = true;
|
||||||
|
//manually fire game over event now
|
||||||
|
Events.fire(new GameOverEvent(defaultTeam));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,8 @@ public class Zone extends UnlockableContent{
|
|||||||
|
|
||||||
/** Whether this zone has met its condition; if true, the player can leave. */
|
/** Whether this zone has met its condition; if true, the player can leave. */
|
||||||
public boolean metCondition(){
|
public boolean metCondition(){
|
||||||
return state.wave >= conditionWave;
|
//players can't leave in attack mode.
|
||||||
|
return state.wave >= conditionWave && !state.rules.attackMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConfigure(){
|
public boolean canConfigure(){
|
||||||
|
@ -359,10 +359,10 @@ public class HudFragment extends Fragment{
|
|||||||
button.getStyle().disabledFontColor = Color.WHITE;
|
button.getStyle().disabledFontColor = Color.WHITE;
|
||||||
button.margin(16f);
|
button.margin(16f);
|
||||||
button.visible(() ->
|
button.visible(() ->
|
||||||
world.isZone() &&
|
world.isZone() &&
|
||||||
world.getZone().metCondition() &&
|
world.getZone().metCondition() &&
|
||||||
!Net.client() &&
|
!Net.client() &&
|
||||||
state.wave % world.getZone().launchPeriod == 0 && !world.spawner.isSpawning());
|
state.wave % world.getZone().launchPeriod == 0 && !world.spawner.isSpawning());
|
||||||
|
|
||||||
button.update(() -> {
|
button.update(() -> {
|
||||||
if(world.getZone() == null){
|
if(world.getZone() == null){
|
||||||
|
Loading…
Reference in New Issue
Block a user