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);
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);
}
});

View File

@ -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();
}

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 final Building tile;
public final UnitCommand command;

View File

@ -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! */

View File

@ -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();
}
}

View File

@ -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,

View File

@ -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);