diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index 6657251783..c17d256bdf 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -112,14 +112,6 @@ public class Logic implements ApplicationListener{ } });*/ - //disable new waves after the boss spawns - Events.on(WaveEvent.class, e -> { - //only works for non-attack sectors - if(state.isCampaign() && state.boss() != null && !state.rules.attackMode){ - state.rules.waitEnemies = true; - } - }); - } /** Handles the event of content being used by either the player or some block. */ @@ -185,10 +177,8 @@ public class Logic implements ApplicationListener{ state.rules.waves = false; } - //check if there is a boss present - Unitc boss = state.boss(); - //if this was a boss wave and there is no boss anymore, then it's a victory - if(boss == null && state.rules.waves && state.rules.waitEnemies){ + //if there's a "win" wave and no enemies are present, win automatically + if(state.rules.waves && state.enemies == 0 && state.rules.winWave > 0 && state.wave >= state.rules.winWave && !spawner.isSpawning()){ //the sector has been conquered - waves get disabled state.rules.waves = false; @@ -222,8 +212,6 @@ public class Logic implements ApplicationListener{ } } } - - } private void updateWeather(){ @@ -321,7 +309,7 @@ public class Logic implements ApplicationListener{ } if(state.rules.waves && state.rules.waveTimer && !state.gameOver){ - if(!state.rules.waitEnemies || state.enemies == 0){ + if(!isWaitingWave()){ state.wavetime = Math.max(state.wavetime - Time.delta(), 0); } } @@ -339,4 +327,9 @@ public class Logic implements ApplicationListener{ } } + /** @return whether the wave timer is paused due to enemies */ + public boolean isWaitingWave(){ + return (state.rules.waitEnemies || (state.wave >= state.rules.winWave && state.rules.winWave > 0)) && state.enemies > 0; + } + } diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index 4848cf6013..f41a5bc6e0 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -62,10 +62,10 @@ public class Rules{ public float dropZoneRadius = 300f; /** Time between waves in ticks. */ public float waveSpacing = 60 * 60 * 2; - /** How many times longer a boss wave takes. */ - public float bossWaveMultiplier = 3f; /** How many times longer a launch wave takes. */ public float launchWaveMultiplier = 2f; + /** Wave after which the player 'wins'. Used in sectors. Use a value <= 0 to disable. */ + public int winWave = 0; /** Base unit cap. Can still be increased by blocks. */ public int unitCap = 0; /** Sector for saves that have them.*/ diff --git a/core/src/mindustry/ui/WarningBar.java b/core/src/mindustry/ui/WarningBar.java index 1bb0579e41..efa124f8ab 100644 --- a/core/src/mindustry/ui/WarningBar.java +++ b/core/src/mindustry/ui/WarningBar.java @@ -27,7 +27,10 @@ public class WarningBar extends Element{ rx + barWidth, y ); } + Lines.stroke(3f); + Lines.line(x, y, x + width, y); + Lines.line(x, y + height, x + width, y + height); - Draw.color(); + Draw.reset(); } } diff --git a/core/src/mindustry/ui/dialogs/SaveDialog.java b/core/src/mindustry/ui/dialogs/SaveDialog.java index 7b53850b54..143206eecf 100644 --- a/core/src/mindustry/ui/dialogs/SaveDialog.java +++ b/core/src/mindustry/ui/dialogs/SaveDialog.java @@ -24,13 +24,11 @@ public class SaveDialog extends LoadDialog{ public void addSetup(){ buttons.button("$save.new", Icon.add, () -> - ui.showTextInput("$save", "$save.newslot", 30, "", text -> { - ui.loadAnd("$saving", () -> { - control.saves.addSave(text); - Core.app.post(() -> Core.app.post(this::setup)); - }); - }) - ).fillX().margin(10f); + ui.showTextInput("$save", "$save.newslot", 30, "", + text -> ui.loadAnd("$saving", () -> { + control.saves.addSave(text); + Core.app.post(() -> Core.app.post(this::setup)); + }))).fillX().margin(10f); } @Override diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index a3382d43d7..97348fa191 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -644,7 +644,7 @@ public class HudFragment extends Fragment{ } if(state.rules.waveTimer){ - builder.append((state.rules.waitEnemies && state.enemies > 0 ? Core.bundle.get("wave.waveInProgress") : ( waitingf.get((int)(state.wavetime/60))))); + builder.append((logic.isWaitingWave() ? Core.bundle.get("wave.waveInProgress") : ( waitingf.get((int)(state.wavetime/60))))); }else if(state.enemies == 0){ builder.append(Core.bundle.get("waiting")); } diff --git a/core/src/mindustry/ui/fragments/LoadingFragment.java b/core/src/mindustry/ui/fragments/LoadingFragment.java index 6da685e4ee..8af45aa79c 100644 --- a/core/src/mindustry/ui/fragments/LoadingFragment.java +++ b/core/src/mindustry/ui/fragments/LoadingFragment.java @@ -21,13 +21,11 @@ public class LoadingFragment extends Fragment{ t.visible(false); t.touchable(Touchable.enabled); t.add().height(133f).row(); - //t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent); - t.add(new WarningBar()).growX().height(30f); + t.add(new WarningBar()).growX().height(24f); t.row(); t.add("$loading").name("namelabel").pad(10f).style(Styles.techLabel); t.row(); - t.add(new WarningBar()).growX().height(30f); - //t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent); + t.add(new WarningBar()).growX().height(24f); t.row(); bar = t.add(new Bar()).pad(3).size(500f, 40f).visible(false).get();