More achievement cleanup
This commit is contained in:
@@ -1,41 +1,36 @@
|
||||
package mindustry.desktop.steam;
|
||||
|
||||
public enum SAchievement{
|
||||
//completeTutorial,
|
||||
kill1kEnemies(SStat.unitsDestroyed, 1000),
|
||||
kill100kEnemies(SStat.unitsDestroyed, 1000 * 100),
|
||||
//TODO achievements for reaching 10k/min production or something
|
||||
launch10kItems(SStat.itemsLaunched, 1000 * 10),
|
||||
//TODO reduce amounts required here
|
||||
launch1milItems(SStat.itemsLaunched, 1000 * 1000),
|
||||
kill100kEnemies(SStat.unitsDestroyed, 100_000),
|
||||
launch10kItems(SStat.itemsLaunched, 10_000),
|
||||
launch1milItems(SStat.itemsLaunched, 1_000_000),
|
||||
|
||||
produce1kMin(SStat.maxProduction, 1000),
|
||||
produce20kMin(SStat.maxProduction, 20_000),
|
||||
win10Attack(SStat.attacksWon, 10),
|
||||
win10PvP(SStat.pvpsWon, 10),
|
||||
defeatAttack5Waves,
|
||||
//TODO
|
||||
launch30Times(SStat.timesLaunched, 30),
|
||||
//TODO
|
||||
captureBackground,
|
||||
//TODO
|
||||
survive100Waves(SStat.maxWavesSurvived, 100),
|
||||
survive500Waves(SStat.maxWavesSurvived, 500),
|
||||
//this seems near-impossible?
|
||||
//survive500Waves(SStat.maxWavesSurvived, 500),
|
||||
researchAll,
|
||||
//TODO
|
||||
useAllUnits,
|
||||
//useAllUnits,
|
||||
shockWetEnemy,
|
||||
killEnemyPhaseWall,
|
||||
researchRouter,
|
||||
place10kBlocks(SStat.blocksBuilt, 10 * 1000),
|
||||
place10kBlocks(SStat.blocksBuilt, 10_000),
|
||||
destroy1kBlocks(SStat.blocksDestroyed, 1000),
|
||||
overheatReactor(SStat.reactorsOverheated, 1),
|
||||
make10maps(SStat.mapsMade, 10),
|
||||
downloadMapWorkshop,
|
||||
publishMap(SStat.mapsPublished, 1),
|
||||
defeatBoss(SStat.bossesDefeated, 1),
|
||||
//TODO
|
||||
captureAllSectors,
|
||||
//TODO
|
||||
capture10Sectors,
|
||||
//TODO
|
||||
control10Sectors,
|
||||
drop10kitems,
|
||||
powerupImpactReactor,
|
||||
obtainThorium,
|
||||
@@ -44,10 +39,12 @@ public enum SAchievement{
|
||||
buildGroundFactory,
|
||||
issueAttackCommand,
|
||||
active100Units(SStat.maxUnitActive, 100),
|
||||
build1000Units,
|
||||
buildAllUnits(SStat.unitsBuilt, 30),
|
||||
//TODO
|
||||
build1000Units(SStat.unitsBuilt, 1000),
|
||||
buildAllUnits(SStat.unitTypesBuilt, 30),
|
||||
buildT5,
|
||||
pickupT5,
|
||||
activeAllT5,
|
||||
active10Polys,
|
||||
dieExclusion,
|
||||
drown,
|
||||
fillCoreAllCampaign,
|
||||
@@ -55,15 +52,11 @@ public enum SAchievement{
|
||||
buildMeltdownSpectreForeshadow,
|
||||
launchItemPad,
|
||||
chainRouters,
|
||||
//TODO
|
||||
circleConveyor,
|
||||
//TODO
|
||||
becomeRouter,
|
||||
//TODO
|
||||
save20Schematics,
|
||||
//TODO
|
||||
destroyEnemyBase,
|
||||
create20Schematics(SStat.schematicsCreated, 20),
|
||||
survive10WavesNoBlocks,
|
||||
captureNoBlocksBroken,
|
||||
useFlameAmmo,
|
||||
coolTurret,
|
||||
enablePixelation,
|
||||
|
||||
@@ -5,11 +5,12 @@ public enum SStat{
|
||||
attacksWon,
|
||||
pvpsWon,
|
||||
timesLaunched,
|
||||
zoneMechsUsed,
|
||||
zoneMechsUsed, //TODO
|
||||
blocksDestroyed,
|
||||
itemsLaunched,
|
||||
reactorsOverheated,
|
||||
maxUnitActive,
|
||||
unitTypesBuilt,
|
||||
unitsBuilt,
|
||||
bossesDefeated,
|
||||
maxPlayersServer,
|
||||
@@ -17,6 +18,9 @@ public enum SStat{
|
||||
mapsPublished,
|
||||
maxWavesSurvived,
|
||||
blocksBuilt,
|
||||
maxProduction,
|
||||
sectorsControlled,
|
||||
schematicsCreated,
|
||||
;
|
||||
|
||||
public int get(){
|
||||
|
||||
@@ -9,6 +9,7 @@ import mindustry.content.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.distribution.*;
|
||||
|
||||
@@ -24,6 +25,8 @@ public class SStats implements SteamUserStatsCallback{
|
||||
private int statSavePeriod = 4; //in minutes
|
||||
|
||||
private ObjectSet<String> blocksBuilt = new ObjectSet<>(), unitsBuilt = new ObjectSet<>();
|
||||
private ObjectSet<UnitType> t5s = new ObjectSet<>();
|
||||
private ObjectSet<UnitType> tmpSet = new ObjectSet<>();
|
||||
|
||||
public SStats(){
|
||||
stats.requestCurrentStats();
|
||||
@@ -36,7 +39,7 @@ public class SStats implements SteamUserStatsCallback{
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(i.get(60f / 4f)){
|
||||
if(i.get(60f)){
|
||||
checkUpdate();
|
||||
}
|
||||
}
|
||||
@@ -58,14 +61,15 @@ public class SStats implements SteamUserStatsCallback{
|
||||
if(campaign()){
|
||||
SStat.maxUnitActive.max(Groups.unit.count(t -> t.team == player.team()));
|
||||
|
||||
//TODO
|
||||
//if(Groups.unit.count(u -> u.type() == UnitTypes.phantom && u.team() == player.team()) >= 10){
|
||||
// active10Phantoms.complete();
|
||||
//}
|
||||
if(Groups.unit.count(u -> u.type == UnitTypes.poly && u.team == player.team()) >= 10){
|
||||
active10Polys.complete();
|
||||
}
|
||||
|
||||
//TODO
|
||||
if(Groups.unit.count(u -> u.type == UnitTypes.crawler && u.team() == player.team()) >= 50){
|
||||
// active50Crawlers.complete();
|
||||
tmpSet.clear();
|
||||
tmpSet.addAll(t5s);
|
||||
Groups.unit.each(u -> tmpSet.remove(u.type));
|
||||
if(tmpSet.size == 0){
|
||||
activeAllT5.complete();
|
||||
}
|
||||
|
||||
for(Building entity : player.team().cores()){
|
||||
@@ -81,6 +85,7 @@ public class SStats implements SteamUserStatsCallback{
|
||||
Events.on(ClientLoadEvent.class, e -> {
|
||||
unitsBuilt = Core.settings.getJson("units-built" , ObjectSet.class, String.class, ObjectSet::new);
|
||||
blocksBuilt = Core.settings.getJson("blocks-built" , ObjectSet.class, String.class, ObjectSet::new);
|
||||
t5s = ObjectSet.with(UnitTypes.omura, UnitTypes.reign, UnitTypes.toxopid, UnitTypes.eclipse, UnitTypes.oct, UnitTypes.corvus);
|
||||
});
|
||||
|
||||
Events.on(UnitDestroyEvent.class, e -> {
|
||||
@@ -95,6 +100,21 @@ public class SStats implements SteamUserStatsCallback{
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(TurnEvent.class, e -> {
|
||||
float total = 0;
|
||||
for(Planet planet : content.planets()){
|
||||
for(Sector sec : planet.sectors){
|
||||
if(sec.hasBase()){
|
||||
for(var v : sec.info.production.values()){
|
||||
total += v.mean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SStat.maxProduction.max((int)total);
|
||||
});
|
||||
|
||||
Events.run(Trigger.newGame, () -> Core.app.post(() -> {
|
||||
if(campaign() && player.core() != null && player.core().items.total() >= 10 * 1000){
|
||||
drop10kitems.complete();
|
||||
@@ -151,11 +171,25 @@ public class SStats implements SteamUserStatsCallback{
|
||||
Events.on(UnitCreateEvent.class, e -> {
|
||||
if(campaign()){
|
||||
if(unitsBuilt.add(e.unit.type.name)){
|
||||
SStat.unitsBuilt.set(content.units().count(u -> unitsBuilt.contains(u.name) && !u.isHidden()));
|
||||
SStat.unitTypesBuilt.set(content.units().count(u -> unitsBuilt.contains(u.name) && !u.isHidden()));
|
||||
}
|
||||
|
||||
if(t5s.contains(e.unit.type)){
|
||||
buildT5.complete();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(UnitControlEvent.class, e -> {
|
||||
if(e.unit instanceof BlockUnitc block && block.tile().block == Blocks.router){
|
||||
becomeRouter.complete();
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(SchematicCreateEvent.class, e -> {
|
||||
SStat.schematicsCreated.add();
|
||||
});
|
||||
|
||||
Events.on(BlockDestroyEvent.class, e -> {
|
||||
if(campaign() && e.tile.team() != player.team()){
|
||||
SStat.blocksDestroyed.add();
|
||||
@@ -207,6 +241,12 @@ public class SStats implements SteamUserStatsCallback{
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(PickupEvent.class, e -> {
|
||||
if(e.carrier.isPlayer() && campaign() && e.unit != null && t5s.contains(e.unit.type)){
|
||||
pickupT5.complete();
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(UnitCreateEvent.class, e -> {
|
||||
if(campaign() && e.unit.team() == player.team()){
|
||||
SStat.unitsBuilt.add();
|
||||
@@ -259,22 +299,34 @@ public class SStats implements SteamUserStatsCallback{
|
||||
Events.on(ClientLoadEvent.class, e -> checkUnlocks.run());
|
||||
|
||||
Events.on(WinEvent.class, e -> {
|
||||
if(state.hasSector()){
|
||||
if(Vars.state.wave <= 5 && state.rules.attackMode){
|
||||
defeatAttack5Waves.complete();
|
||||
}
|
||||
|
||||
if(Vars.state.rules.attackMode){
|
||||
SStat.attacksWon.add();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.rules.pvp){
|
||||
SStat.pvpsWon.add();
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(SectorCaptureEvent.class, e -> {
|
||||
if(Vars.state.wave <= 5 && state.rules.attackMode){
|
||||
defeatAttack5Waves.complete();
|
||||
}
|
||||
|
||||
if(state.stats.buildingsDestroyed == 0){
|
||||
captureNoBlocksBroken.complete();
|
||||
}
|
||||
|
||||
if(Vars.state.rules.attackMode){
|
||||
SStat.attacksWon.add();
|
||||
}
|
||||
|
||||
if(!e.sector.isBeingPlayed()){
|
||||
captureBackground.complete();
|
||||
}
|
||||
|
||||
if(!e.sector.planet.sectors.contains(s -> s.hasBase())){
|
||||
captureAllSectors.complete();
|
||||
}
|
||||
|
||||
SStat.sectorsControlled.set(e.sector.planet.sectors.count(s -> s.hasBase()));
|
||||
});
|
||||
|
||||
//TODO dead achievement
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user