Minor achievement cleanup

This commit is contained in:
Anuken
2020-11-03 17:19:00 -05:00
parent dc3e376be5
commit 775327ebcb
7 changed files with 38 additions and 40 deletions

View File

@@ -301,6 +301,7 @@ public class Control implements ApplicationListener, Loadable{
player.set(spawn.x * tilesize, spawn.y * tilesize); player.set(spawn.x * tilesize, spawn.y * tilesize);
camera.position.set(player); camera.position.set(player);
Events.fire(new SectorLaunchEvent(sector));
Events.fire(Trigger.newGame); Events.fire(Trigger.newGame);
} }
@@ -324,6 +325,7 @@ public class Control implements ApplicationListener, Loadable{
sector.info.destination = origin; sector.info.destination = origin;
logic.play(); logic.play();
control.saves.saveSector(sector); control.saves.saveSector(sector);
Events.fire(new SectorLaunchEvent(sector));
Events.fire(Trigger.newGame); Events.fire(Trigger.newGame);
} }
}); });

View File

@@ -357,6 +357,7 @@ public class UI implements ApplicationListener, Loadable{
hide(); hide();
listener.run(); listener.run();
}).size(110, 50).pad(4); }).size(110, 50).pad(4);
closeOnBack();
}}.show(); }}.show();
} }
@@ -365,6 +366,7 @@ public class UI implements ApplicationListener, Loadable{
getCell(cont).growX(); getCell(cont).growX();
cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.left); cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.left);
buttons.button("@ok", this::hide).size(110, 50).pad(4); buttons.button("@ok", this::hide).size(110, 50).pad(4);
closeOnBack();
}}.show(); }}.show();
} }

View File

@@ -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 static class CommandIssueEvent{
public final Building tile; public final Building tile;
public final UnitCommand command; public final UnitCommand command;

View File

@@ -18,7 +18,7 @@ import static mindustry.Vars.*;
public class Planet extends UnlockableContent{ public class Planet extends UnlockableContent{
/** Default spacing between planet orbits in world units. */ /** Default spacing between planet orbits in world units. */
private static final float orbitSpacing = 8f; private static final float orbitSpacing = 9f;
/** intersect() temp var. */ /** intersect() temp var. */
private static final Vec3 intersectResult = new Vec3(); private static final Vec3 intersectResult = new Vec3();
/** Mesh used for rendering. Created on load() - will be null on the server! */ /** Mesh used for rendering. Created on load() - will be null on the server! */

View File

@@ -383,8 +383,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stable.row(); stable.row();
if(sector.info.wavesSurvived >= 0 && sector.info.wavesSurvived - sector.info.wavesPassed >= 0 && !sector.isBeingPlayed()){ 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; 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(); stable.row();
} }
} }

View File

@@ -31,32 +31,28 @@ public enum SAchievement{
defeatBoss(SStat.bossesDefeated, 1), defeatBoss(SStat.bossesDefeated, 1),
//TODO //TODO
captureAllSectors, captureAllSectors,
//configAllZones, //TODO
capture10Sectors,
//TODO
drop10kitems, drop10kitems,
powerupImpactReactor, powerupImpactReactor,
obtainThorium, obtainThorium,
obtainTitanium, obtainTitanium,
suicideBomb, suicideBomb,
buildDaggerFactory, buildGroundFactory,
issueAttackCommand, issueAttackCommand,
active100Units(SStat.maxUnitActive, 100), active100Units(SStat.maxUnitActive, 100),
active10Phantoms,
active50Crawlers,
build1000Units, build1000Units,
//TODO //TODO
buildAllUnits, buildAllUnits,
//TODO //TODO
activeAllT5, activeAllT5,
//TODO
//earnSRank,
//earnSSRank,
dieExclusion, dieExclusion,
drown, drown,
fillCoreAllCampaign, fillCoreAllCampaign,
hostServer10(SStat.maxPlayersServer, 10), hostServer10(SStat.maxPlayersServer, 10),
buildMeltdownSpectreForeshadow, buildMeltdownSpectreForeshadow,
launchItemPad, launchItemPad,
//skipLaunching2Death,
chainRouters, chainRouters,
//TODO //TODO
becomeRouter, becomeRouter,

View File

@@ -8,7 +8,6 @@ import mindustry.content.*;
import mindustry.entities.units.*; import mindustry.entities.units.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.type.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
import static mindustry.desktop.steam.SAchievement.*; import static mindustry.desktop.steam.SAchievement.*;
@@ -59,8 +58,9 @@ public class SStats implements SteamUserStatsCallback{
// active10Phantoms.complete(); // active10Phantoms.complete();
//} //}
//TODO
if(Groups.unit.count(u -> u.type == UnitTypes.crawler && u.team() == player.team()) >= 50){ if(Groups.unit.count(u -> u.type == UnitTypes.crawler && u.team() == player.team()) >= 50){
active50Crawlers.complete(); // active50Crawlers.complete();
} }
for(Building entity : player.team().cores()){ for(Building entity : player.team().cores()){
@@ -75,23 +75,16 @@ public class SStats implements SteamUserStatsCallback{
private void registerEvents(){ private void registerEvents(){
Events.on(UnitDestroyEvent.class, e -> { Events.on(UnitDestroyEvent.class, e -> {
if(ncustom()){ if(ncustom()){
if(e.unit.team() != Vars.player.team()){ if(e.unit.team != Vars.player.team()){
SStat.unitsDestroyed.add(); SStat.unitsDestroyed.add();
if(e.unit instanceof Unit && ((Unit)e.unit).isBoss()){ if(e.unit.isBoss()){
SStat.bossesDefeated.add(); 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(() -> { Events.run(Trigger.newGame, () -> Core.app.post(() -> {
if(campaign() && player.core() != null && player.core().items.total() >= 10 * 1000){ if(campaign() && player.core() != null && player.core().items.total() >= 10 * 1000){
drop10kitems.complete(); drop10kitems.complete();
@@ -113,16 +106,21 @@ public class SStats implements SteamUserStatsCallback{
} }
//TODO implement //TODO implement
//if(e.tile.block() == Blocks.daggerFactory){ if(e.tile.block() == Blocks.groundFactory){
// buildDaggerFactory.complete(); buildGroundFactory.complete();
//} }
if(e.tile.block() == Blocks.meltdown || e.tile.block() == Blocks.spectre){ //TODO fix, cleaner impl
if(e.tile.block() == Blocks.meltdown && !Core.settings.getBool("meltdownp", false)){ 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); 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); Core.settings.put("spectrep", true);
} }
@@ -147,11 +145,6 @@ public class SStats implements SteamUserStatsCallback{
Events.on(UnlockEvent.class, e -> { Events.on(UnlockEvent.class, e -> {
if(e.content == Items.thorium) obtainThorium.complete(); if(e.content == Items.thorium) obtainThorium.complete();
if(e.content == Items.titanium) obtainTitanium.complete(); if(e.content == Items.titanium) obtainTitanium.complete();
if(!content.sectors().contains(SectorPreset::locked)){
//TODO
//unlockAllZones.complete();
}
}); });
Events.run(Trigger.openWiki, openWiki::complete); Events.run(Trigger.openWiki, openWiki::complete);
@@ -197,14 +190,9 @@ public class SStats implements SteamUserStatsCallback{
} }
}); });
//TODO Events.on(SectorLaunchEvent.class, e -> {
//Events.on(LaunchEvent.class, e -> { SStat.timesLaunched.add();
// if(state.rules.tutorial){ });
// completeTutorial.complete();
// }
//
// SStat.timesLaunched.add();
//});
Events.on(LaunchItemEvent.class, e -> { Events.on(LaunchItemEvent.class, e -> {
SStat.itemsLaunched.add(e.stack.amount); SStat.itemsLaunched.add(e.stack.amount);