From 8d8cedaa442cb4ce3ab519c7b5c3b701570184e8 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 24 Sep 2020 16:44:11 -0400 Subject: [PATCH] Removed launch mechanic remnants --- core/src/mindustry/core/Logic.java | 55 +---------------- core/src/mindustry/game/EventType.java | 1 - core/src/mindustry/game/Rules.java | 2 - core/src/mindustry/type/Sector.java | 13 ---- .../mindustry/ui/fragments/HudFragment.java | 61 +------------------ .../src/mindustry/desktop/steam/SStats.java | 15 ++--- 6 files changed, 10 insertions(+), 137 deletions(-) diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index 9058539764..2d9bf18c49 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -4,7 +4,6 @@ import arc.*; import arc.math.*; import arc.util.*; import mindustry.annotations.Annotations.*; -import mindustry.content.*; import mindustry.core.GameState.*; import mindustry.game.EventType.*; import mindustry.game.*; @@ -178,7 +177,7 @@ public class Logic implements ApplicationListener{ public void runWave(){ spawner.spawnEnemies(); state.wave++; - state.wavetime = state.hasSector() && state.getSector().isLaunchWave(state.wave) ? state.rules.waveSpacing * state.rules.launchWaveMultiplier : state.rules.waveSpacing; + state.wavetime = state.rules.waveSpacing; Events.fire(new WaveEvent()); } @@ -251,58 +250,6 @@ public class Logic implements ApplicationListener{ } } - @Remote(called = Loc.both) - public static void launchZone(){ - if(!state.isCampaign()) return; - - if(!headless){ - ui.hudfrag.showLaunch(); - } - - //TODO better core launch effect - for(Building tile : state.teams.playerCores()){ - Fx.launch.at(tile); - } - - Sector sector = state.rules.sector; - - //TODO containers must be launched too - Time.runTask(30f, () -> { - Sector origin = sector.save.meta.secinfo.origin; - if(origin != null){ - ItemSeq stacks = origin.getExtraItems(); - - //add up all items into list - for(Building entity : state.teams.playerCores()){ - entity.items.each(stacks::add); - } - - //save received items - origin.setExtraItems(stacks); - } - - //remove all the cores - state.teams.playerCores().each(b -> b.tile.remove()); - - state.launched = true; - state.gameOver = true; - - //save over the data w/o the cores - sector.save.save(); - - //run a turn, since launching takes up a turn - universe.runTurn(); - - //TODO apply extra damage to sector - //sector.setTurnsPassed(sector.getTurnsPassed() + 3); - - //TODO load the sector that was launched from - Events.fire(new LaunchEvent()); - //manually fire game over event now - Events.fire(new GameOverEvent(state.rules.defaultTeam)); - }); - } - @Remote(called = Loc.both) public static void updateGameOver(Team winner){ state.gameOver = true; diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index 98622b4bc5..b2e26c9b1f 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -40,7 +40,6 @@ public class EventType{ public static class WinEvent{} public static class LoseEvent{} - public static class LaunchEvent{} public static class ResizeEvent{} public static class MapMakeEvent{} public static class MapPublishEvent{} diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index e0937c9b2b..ac302a9754 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -68,8 +68,6 @@ public class Rules{ public float dropZoneRadius = 300f; /** Time between waves in ticks. */ public float waveSpacing = 60 * 60 * 2; - /** 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. */ diff --git a/core/src/mindustry/type/Sector.java b/core/src/mindustry/type/Sector.java index 19bc03f874..67bff0b396 100644 --- a/core/src/mindustry/type/Sector.java +++ b/core/src/mindustry/type/Sector.java @@ -31,9 +31,6 @@ public class Sector{ public float baseCoverage; public boolean generateEnemyBase; - //TODO implement a dynamic launch period - public int launchPeriod = 10; - public Sector(Planet planet, Ptile tile){ this.planet = planet; this.tile = tile; @@ -134,16 +131,6 @@ public class Sector{ return res % 2 == 0 ? res : res + 1; } - //TODO implement - public boolean isLaunchWave(int wave){ - return metCondition() && wave % launchPeriod == 0; - } - - public boolean metCondition(){ - //TODO implement - return false; - } - //TODO this should be stored in a more efficient structure, and be updated each turn public ItemSeq getExtraItems(){ return Core.settings.getJson(key("extra-items"), ItemSeq.class, ItemSeq::new); diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index e5b6dd9713..a1cd52354d 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -4,7 +4,6 @@ import arc.*; import arc.func.*; import arc.graphics.*; import arc.graphics.g2d.*; -import arc.input.*; import arc.math.*; import arc.scene.*; import arc.scene.actions.*; @@ -26,7 +25,6 @@ import mindustry.input.*; import mindustry.net.Packets.*; import mindustry.type.*; import mindustry.ui.*; -import mindustry.ui.dialogs.*; import static mindustry.Vars.*; @@ -173,8 +171,6 @@ public class HudFragment extends Fragment{ s.button(Icon.play, Styles.righti, 30f, () -> { if(net.client() && player.admin){ Call.adminRequest(player, AdminAction.wave); - }else if(inLaunchWave()){ - ui.showConfirm("@confirm", "@launch.skip.confirm", () -> !canSkipWave(), () -> logic.skipWave()); }else{ logic.skipWave(); } @@ -576,40 +572,6 @@ public class HudFragment extends Fragment{ Core.scene.add(image); } - private void showLaunchConfirm(){ - BaseDialog dialog = new BaseDialog("@launch"); - dialog.update(() -> { - if(!inLaunchWave()){ - dialog.hide(); - } - }); - dialog.cont.add("@launch.confirm").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center); - dialog.buttons.defaults().size(200f, 54f).pad(2f); - dialog.setFillParent(false); - dialog.buttons.button("@cancel", dialog::hide); - dialog.buttons.button("@ok", () -> { - dialog.hide(); - Call.launchZone(); - }); - dialog.keyDown(KeyCode.escape, dialog::hide); - dialog.keyDown(KeyCode.back, dialog::hide); - dialog.show(); - } - - //TODO launching is disabled, possibly forever - private boolean inLaunchWave(){ - return false; - /* - return state.hasSector() && - state.getSector().metCondition() && - !net.client() && - state.wave % state.getSector().launchPeriod == 0 && !spawner.isSpawning();*/ - } - - private boolean canLaunch(){ - return inLaunchWave() && state.enemies <= 0; - } - private void toggleMenus(){ if(flip != null){ flip.getStyle().imageUp = shown ? Icon.downOpen : Icon.upOpen; @@ -752,22 +714,6 @@ public class HudFragment extends Fragment{ builder.append(wavef.get(state.wave)); builder.append("\n"); - if(inLaunchWave()){ - builder.append("[#"); - Tmp.c1.set(Color.white).lerp(state.enemies > 0 ? Color.white : Color.scarlet, Mathf.absin(Time.time(), 2f, 1f)).toString(builder); - builder.append("]"); - - if(!canLaunch()){ - builder.append(Core.bundle.get("launch.unable2")); - }else{ - builder.append(Core.bundle.get("launch")); - builder.append("\n"); - builder.append(Core.bundle.format("launch.next", state.wave + state.getSector().launchPeriod)); - builder.append("\n"); - } - builder.append("[]\n"); - } - if(state.enemies > 0){ if(state.enemies == 1){ builder.append(enemyf.get(state.enemies)); @@ -786,13 +732,8 @@ public class HudFragment extends Fragment{ return builder; }).growX().pad(8f); - table.setDisabled(() -> !canLaunch()); + table.setDisabled(true); table.visible(() -> state.rules.waves); - table.clicked(() -> { - if(canLaunch()){ - showLaunchConfirm(); - } - }); return table; } diff --git a/desktop/src/mindustry/desktop/steam/SStats.java b/desktop/src/mindustry/desktop/steam/SStats.java index ce24a22635..cd927030a8 100644 --- a/desktop/src/mindustry/desktop/steam/SStats.java +++ b/desktop/src/mindustry/desktop/steam/SStats.java @@ -196,13 +196,14 @@ public class SStats implements SteamUserStatsCallback{ } }); - Events.on(LaunchEvent.class, e -> { - if(state.rules.tutorial){ - completeTutorial.complete(); - } - - SStat.timesLaunched.add(); - }); + //TODO + //Events.on(LaunchEvent.class, e -> { + // if(state.rules.tutorial){ + // completeTutorial.complete(); + // } +// + // SStat.timesLaunched.add(); + //}); Events.on(LaunchItemEvent.class, e -> { SStat.itemsLaunched.add(e.stack.amount);