From 775327ebcbe4826a98d2c6850ad23ce2af9eb611 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 3 Nov 2020 17:19:00 -0500 Subject: [PATCH] Minor achievement cleanup --- core/src/mindustry/core/Control.java | 2 + core/src/mindustry/core/UI.java | 2 + core/src/mindustry/game/EventType.java | 8 ++++ core/src/mindustry/type/Planet.java | 2 +- .../mindustry/ui/dialogs/PlanetDialog.java | 4 +- .../mindustry/desktop/steam/SAchievement.java | 12 ++--- .../src/mindustry/desktop/steam/SStats.java | 48 +++++++------------ 7 files changed, 38 insertions(+), 40 deletions(-) diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 4aae84a735..acadd51df7 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -301,6 +301,7 @@ public class Control implements ApplicationListener, Loadable{ player.set(spawn.x * tilesize, spawn.y * tilesize); camera.position.set(player); + Events.fire(new SectorLaunchEvent(sector)); Events.fire(Trigger.newGame); } @@ -324,6 +325,7 @@ public class Control implements ApplicationListener, Loadable{ sector.info.destination = origin; logic.play(); control.saves.saveSector(sector); + Events.fire(new SectorLaunchEvent(sector)); Events.fire(Trigger.newGame); } }); diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index da264d6af7..2a8c1925f8 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -357,6 +357,7 @@ public class UI implements ApplicationListener, Loadable{ hide(); listener.run(); }).size(110, 50).pad(4); + closeOnBack(); }}.show(); } @@ -365,6 +366,7 @@ public class UI implements ApplicationListener, Loadable{ getCell(cont).growX(); cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.left); buttons.button("@ok", this::hide).size(110, 50).pad(4); + closeOnBack(); }}.show(); } diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index 1ab946c4ac..5d67d689ff 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -96,6 +96,14 @@ public class EventType{ } } + public static class SectorLaunchEvent{ + public final Sector sector; + + public SectorLaunchEvent(Sector sector){ + this.sector = sector; + } + } + public static class CommandIssueEvent{ public final Building tile; public final UnitCommand command; diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index 4550ae6805..200fa9ef6a 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -18,7 +18,7 @@ import static mindustry.Vars.*; public class Planet extends UnlockableContent{ /** Default spacing between planet orbits in world units. */ - private static final float orbitSpacing = 8f; + private static final float orbitSpacing = 9f; /** intersect() temp var. */ private static final Vec3 intersectResult = new Vec3(); /** Mesh used for rendering. Created on load() - will be null on the server! */ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index a2122381c9..96752008a1 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -383,8 +383,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ stable.row(); if(sector.info.wavesSurvived >= 0 && sector.info.wavesSurvived - sector.info.wavesPassed >= 0 && !sector.isBeingPlayed()){ + int toCapture = sector.info.attack || sector.info.winWave <= 1 ? -1 : sector.info.winWave - (sector.info.wave + sector.info.wavesPassed); boolean plus = (sector.info.wavesSurvived - sector.info.wavesPassed) >= SectorDamage.maxRetWave - 1; - stable.add("[accent]Will survive\n" + (sector.info.wavesSurvived - sector.info.wavesPassed) + (plus ? "+" : "") + " waves"); + stable.add("[accent]Will survive\n" + (sector.info.wavesSurvived - sector.info.wavesPassed) + + (plus ? "+" : "") + (toCapture < 0 ? "" : "/" + toCapture) + " waves"); stable.row(); } } diff --git a/desktop/src/mindustry/desktop/steam/SAchievement.java b/desktop/src/mindustry/desktop/steam/SAchievement.java index 80cf98e7fe..8d20447f58 100644 --- a/desktop/src/mindustry/desktop/steam/SAchievement.java +++ b/desktop/src/mindustry/desktop/steam/SAchievement.java @@ -31,32 +31,28 @@ public enum SAchievement{ defeatBoss(SStat.bossesDefeated, 1), //TODO captureAllSectors, - //configAllZones, + //TODO + capture10Sectors, + //TODO drop10kitems, powerupImpactReactor, obtainThorium, obtainTitanium, suicideBomb, - buildDaggerFactory, + buildGroundFactory, issueAttackCommand, active100Units(SStat.maxUnitActive, 100), - active10Phantoms, - active50Crawlers, build1000Units, //TODO buildAllUnits, //TODO activeAllT5, - //TODO - //earnSRank, - //earnSSRank, dieExclusion, drown, fillCoreAllCampaign, hostServer10(SStat.maxPlayersServer, 10), buildMeltdownSpectreForeshadow, launchItemPad, - //skipLaunching2Death, chainRouters, //TODO becomeRouter, diff --git a/desktop/src/mindustry/desktop/steam/SStats.java b/desktop/src/mindustry/desktop/steam/SStats.java index 968b7f8b67..910c38cad2 100644 --- a/desktop/src/mindustry/desktop/steam/SStats.java +++ b/desktop/src/mindustry/desktop/steam/SStats.java @@ -8,7 +8,6 @@ import mindustry.content.*; import mindustry.entities.units.*; import mindustry.game.EventType.*; import mindustry.gen.*; -import mindustry.type.*; import static mindustry.Vars.*; import static mindustry.desktop.steam.SAchievement.*; @@ -59,8 +58,9 @@ public class SStats implements SteamUserStatsCallback{ // active10Phantoms.complete(); //} + //TODO if(Groups.unit.count(u -> u.type == UnitTypes.crawler && u.team() == player.team()) >= 50){ - active50Crawlers.complete(); + // active50Crawlers.complete(); } for(Building entity : player.team().cores()){ @@ -75,23 +75,16 @@ public class SStats implements SteamUserStatsCallback{ private void registerEvents(){ Events.on(UnitDestroyEvent.class, e -> { if(ncustom()){ - if(e.unit.team() != Vars.player.team()){ + if(e.unit.team != Vars.player.team()){ SStat.unitsDestroyed.add(); - if(e.unit instanceof Unit && ((Unit)e.unit).isBoss()){ + if(e.unit.isBoss()){ SStat.bossesDefeated.add(); } } } }); - //TODO achievement invalid - //Events.on(ZoneConfigureCompleteEvent.class, e -> { - //if(!content.sectors().contains(z -> !z.canConfigure())){ - // configAllZones.complete(); - //} - //}); - Events.run(Trigger.newGame, () -> Core.app.post(() -> { if(campaign() && player.core() != null && player.core().items.total() >= 10 * 1000){ drop10kitems.complete(); @@ -113,16 +106,21 @@ public class SStats implements SteamUserStatsCallback{ } //TODO implement - //if(e.tile.block() == Blocks.daggerFactory){ - // buildDaggerFactory.complete(); - //} + if(e.tile.block() == Blocks.groundFactory){ + buildGroundFactory.complete(); + } - if(e.tile.block() == Blocks.meltdown || e.tile.block() == Blocks.spectre){ - if(e.tile.block() == Blocks.meltdown && !Core.settings.getBool("meltdownp", false)){ + //TODO fix, cleaner impl + if(e.tile.block() == Blocks.meltdown || e.tile.block() == Blocks.spectre || e.tile.block() == Blocks.foreshadow){ + if(e.tile.block() == Blocks.meltdown){ Core.settings.put("meltdownp", true); } - if(e.tile.block() == Blocks.spectre && !Core.settings.getBool("spectrep", false)){ + if(e.tile.block() == Blocks.spectre){ + Core.settings.put("spectrep", true); + } + + if(e.tile.block() == Blocks.foreshadow){ Core.settings.put("spectrep", true); } @@ -147,11 +145,6 @@ public class SStats implements SteamUserStatsCallback{ Events.on(UnlockEvent.class, e -> { if(e.content == Items.thorium) obtainThorium.complete(); if(e.content == Items.titanium) obtainTitanium.complete(); - - if(!content.sectors().contains(SectorPreset::locked)){ - //TODO - //unlockAllZones.complete(); - } }); Events.run(Trigger.openWiki, openWiki::complete); @@ -197,14 +190,9 @@ public class SStats implements SteamUserStatsCallback{ } }); - //TODO - //Events.on(LaunchEvent.class, e -> { - // if(state.rules.tutorial){ - // completeTutorial.complete(); - // } -// - // SStat.timesLaunched.add(); - //}); + Events.on(SectorLaunchEvent.class, e -> { + SStat.timesLaunched.add(); + }); Events.on(LaunchItemEvent.class, e -> { SStat.itemsLaunched.add(e.stack.amount);