More achievement cleanup
This commit is contained in:
@@ -17,14 +17,12 @@ public class EventType{
|
|||||||
phaseDeflectHit,
|
phaseDeflectHit,
|
||||||
impactPower,
|
impactPower,
|
||||||
thoriumReactorOverheat,
|
thoriumReactorOverheat,
|
||||||
itemLaunch,
|
|
||||||
fireExtinguish,
|
fireExtinguish,
|
||||||
newGame,
|
newGame,
|
||||||
tutorialComplete,
|
tutorialComplete,
|
||||||
flameAmmo,
|
flameAmmo,
|
||||||
turretCool,
|
turretCool,
|
||||||
enablePixelation,
|
enablePixelation,
|
||||||
drown,
|
|
||||||
exclusionDeath,
|
exclusionDeath,
|
||||||
suicideBomb,
|
suicideBomb,
|
||||||
openWiki,
|
openWiki,
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ public class SectorDamage{
|
|||||||
//first, calculate the total health of blocks in the path
|
//first, calculate the total health of blocks in the path
|
||||||
|
|
||||||
//radius around the path that gets counted
|
//radius around the path that gets counted
|
||||||
int radius = 9;
|
int radius = 8;
|
||||||
IntSet counted = new IntSet();
|
IntSet counted = new IntSet();
|
||||||
|
|
||||||
for(Tile t : sparse2){
|
for(Tile t : sparse2){
|
||||||
@@ -337,7 +337,7 @@ public class SectorDamage{
|
|||||||
//enemy units like to aim for a lot of non-essential things, so increase resulting health slightly
|
//enemy units like to aim for a lot of non-essential things, so increase resulting health slightly
|
||||||
info.sumHealth = sumHealth * 1.2f;
|
info.sumHealth = sumHealth * 1.2f;
|
||||||
//players tend to have longer range units/turrets, so assume DPS is higher
|
//players tend to have longer range units/turrets, so assume DPS is higher
|
||||||
info.sumDps = sumDps * 1.5f;
|
info.sumDps = sumDps * 1.2f;
|
||||||
info.sumRps = sumRps;
|
info.sumRps = sumRps;
|
||||||
|
|
||||||
info.wavesSurvived = getWavesSurvived(info);
|
info.wavesSurvived = getWavesSurvived(info);
|
||||||
|
|||||||
@@ -374,6 +374,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
stable.add("[accent]Difficulty: " + (int)(sector.baseCoverage * 10)).row();
|
stable.add("[accent]Difficulty: " + (int)(sector.baseCoverage * 10)).row();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO put most info in submenu
|
||||||
|
|
||||||
if(sector.isAttacked()){
|
if(sector.isAttacked()){
|
||||||
//TODO localize when finalized
|
//TODO localize when finalized
|
||||||
//these mechanics are likely to change and as such are not added to the bundle
|
//these mechanics are likely to change and as such are not added to the bundle
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package mindustry.world.blocks.units;
|
package mindustry.world.blocks.units;
|
||||||
|
|
||||||
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
@@ -12,6 +13,7 @@ import mindustry.*;
|
|||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
@@ -33,6 +35,7 @@ public class CommandCenter extends Block{
|
|||||||
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
|
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
|
||||||
build.team.data().command = command;
|
build.team.data().command = command;
|
||||||
effect.at(build);
|
effect.at(build);
|
||||||
|
Events.fire(new CommandIssueEvent(build, command));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package mindustry.desktop.steam;
|
package mindustry.desktop.steam;
|
||||||
|
|
||||||
public enum SAchievement{
|
public enum SAchievement{
|
||||||
completeTutorial,
|
//completeTutorial,
|
||||||
kill1kEnemies(SStat.unitsDestroyed, 1000),
|
kill1kEnemies(SStat.unitsDestroyed, 1000),
|
||||||
kill100kEnemies(SStat.unitsDestroyed, 1000 * 100),
|
kill100kEnemies(SStat.unitsDestroyed, 1000 * 100),
|
||||||
|
//TODO achievements for reaching 10k/min production or something
|
||||||
launch10kItems(SStat.itemsLaunched, 1000 * 10),
|
launch10kItems(SStat.itemsLaunched, 1000 * 10),
|
||||||
|
//TODO reduce amounts required here
|
||||||
launch1milItems(SStat.itemsLaunched, 1000 * 1000),
|
launch1milItems(SStat.itemsLaunched, 1000 * 1000),
|
||||||
win10Attack(SStat.attacksWon, 10),
|
win10Attack(SStat.attacksWon, 10),
|
||||||
win10PvP(SStat.pvpsWon, 10),
|
win10PvP(SStat.pvpsWon, 10),
|
||||||
@@ -43,8 +45,7 @@ public enum SAchievement{
|
|||||||
issueAttackCommand,
|
issueAttackCommand,
|
||||||
active100Units(SStat.maxUnitActive, 100),
|
active100Units(SStat.maxUnitActive, 100),
|
||||||
build1000Units,
|
build1000Units,
|
||||||
//TODO
|
buildAllUnits(SStat.unitsBuilt, 30),
|
||||||
buildAllUnits,
|
|
||||||
//TODO
|
//TODO
|
||||||
activeAllT5,
|
activeAllT5,
|
||||||
dieExclusion,
|
dieExclusion,
|
||||||
@@ -55,9 +56,13 @@ public enum SAchievement{
|
|||||||
launchItemPad,
|
launchItemPad,
|
||||||
chainRouters,
|
chainRouters,
|
||||||
//TODO
|
//TODO
|
||||||
|
circleConveyor,
|
||||||
|
//TODO
|
||||||
becomeRouter,
|
becomeRouter,
|
||||||
//TODO
|
//TODO
|
||||||
save20Schematics,
|
save20Schematics,
|
||||||
|
//TODO
|
||||||
|
destroyEnemyBase,
|
||||||
survive10WavesNoBlocks,
|
survive10WavesNoBlocks,
|
||||||
useFlameAmmo,
|
useFlameAmmo,
|
||||||
coolTurret,
|
coolTurret,
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ public enum SStat{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(int amount){
|
public void set(int amount){
|
||||||
SVars.stats.stats.setStatI(name(), get() + amount);
|
SVars.stats.stats.setStatI(name(), amount);
|
||||||
SVars.stats.onUpdate();
|
SVars.stats.onUpdate();
|
||||||
|
|
||||||
for(SAchievement a : SAchievement.all){
|
for(SAchievement a : SAchievement.all){
|
||||||
@@ -38,6 +38,10 @@ public enum SStat{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add(int amount){
|
||||||
|
set(get() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
public void add(){
|
public void add(){
|
||||||
add(1);
|
add(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mindustry.desktop.steam;
|
package mindustry.desktop.steam;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import com.codedisaster.steamworks.*;
|
import com.codedisaster.steamworks.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
@@ -8,6 +9,8 @@ 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.world.*;
|
||||||
|
import mindustry.world.blocks.distribution.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
import static mindustry.desktop.steam.SAchievement.*;
|
import static mindustry.desktop.steam.SAchievement.*;
|
||||||
@@ -20,6 +23,8 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
//private ObjectSet<String> mechs = new ObjectSet<>();
|
//private ObjectSet<String> mechs = new ObjectSet<>();
|
||||||
private int statSavePeriod = 4; //in minutes
|
private int statSavePeriod = 4; //in minutes
|
||||||
|
|
||||||
|
private ObjectSet<String> blocksBuilt = new ObjectSet<>(), unitsBuilt = new ObjectSet<>();
|
||||||
|
|
||||||
public SStats(){
|
public SStats(){
|
||||||
stats.requestCurrentStats();
|
stats.requestCurrentStats();
|
||||||
|
|
||||||
@@ -51,7 +56,7 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
|
|
||||||
void checkUpdate(){
|
void checkUpdate(){
|
||||||
if(campaign()){
|
if(campaign()){
|
||||||
SStat.maxUnitActive.max(Groups.unit.count(t -> t.team() == player.team()));
|
SStat.maxUnitActive.max(Groups.unit.count(t -> t.team == player.team()));
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
//if(Groups.unit.count(u -> u.type() == UnitTypes.phantom && u.team() == player.team()) >= 10){
|
//if(Groups.unit.count(u -> u.type() == UnitTypes.phantom && u.team() == player.team()) >= 10){
|
||||||
@@ -73,6 +78,11 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerEvents(){
|
private void registerEvents(){
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
|
||||||
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()){
|
||||||
@@ -105,33 +115,47 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
chainRouters.complete();
|
chainRouters.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO implement
|
|
||||||
if(e.tile.block() == Blocks.groundFactory){
|
if(e.tile.block() == Blocks.groundFactory){
|
||||||
buildGroundFactory.complete();
|
buildGroundFactory.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO fix, cleaner impl
|
if(blocksBuilt.add(e.tile.block().name)){
|
||||||
if(e.tile.block() == Blocks.meltdown || e.tile.block() == Blocks.spectre || e.tile.block() == Blocks.foreshadow){
|
if(blocksBuilt.contains("meltdown") && blocksBuilt.contains("spectre") && blocksBuilt.contains("foreshadow")){
|
||||||
if(e.tile.block() == Blocks.meltdown){
|
buildMeltdownSpectreForeshadow.complete();
|
||||||
Core.settings.put("meltdownp", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e.tile.block() == Blocks.spectre){
|
save();
|
||||||
Core.settings.put("spectrep", true);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(e.tile.block() == Blocks.foreshadow){
|
if(e.tile.block() instanceof Conveyor){
|
||||||
Core.settings.put("spectrep", true);
|
check: {
|
||||||
}
|
Tile current = e.tile;
|
||||||
|
for(int i = 0; i < 4; i++){
|
||||||
|
if(current.build == null) break check;
|
||||||
|
Tile next = current.nearby(current.build.rotation);
|
||||||
|
if(next != null && next.block() instanceof Conveyor){
|
||||||
|
current = next;
|
||||||
|
}else{
|
||||||
|
break check;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(Core.settings.getBool("meltdownp", false) && Core.settings.getBool("spectrep", false)){
|
if(current == e.tile){
|
||||||
//TODO
|
circleConveyor.complete();
|
||||||
//buildMeltdownSpectre.complete();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Events.on(BlockDestroyEvent.class, e -> {
|
Events.on(BlockDestroyEvent.class, e -> {
|
||||||
if(campaign() && e.tile.team() != player.team()){
|
if(campaign() && e.tile.team() != player.team()){
|
||||||
SStat.blocksDestroyed.add();
|
SStat.blocksDestroyed.add();
|
||||||
@@ -151,7 +175,11 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
|
|
||||||
Events.run(Trigger.exclusionDeath, dieExclusion::complete);
|
Events.run(Trigger.exclusionDeath, dieExclusion::complete);
|
||||||
|
|
||||||
Events.run(Trigger.drown, drown::complete);
|
Events.on(UnitDrownEvent.class, e -> {
|
||||||
|
if(campaign() && e.unit.isPlayer()){
|
||||||
|
drown.complete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
trigger(Trigger.impactPower, powerupImpactReactor);
|
trigger(Trigger.impactPower, powerupImpactReactor);
|
||||||
|
|
||||||
@@ -173,7 +201,11 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
|
|
||||||
trigger(Trigger.phaseDeflectHit, killEnemyPhaseWall);
|
trigger(Trigger.phaseDeflectHit, killEnemyPhaseWall);
|
||||||
|
|
||||||
trigger(Trigger.itemLaunch, launchItemPad);
|
Events.on(LaunchItemEvent.class, e -> {
|
||||||
|
if(campaign()){
|
||||||
|
launchItemPad.complete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Events.on(UnitCreateEvent.class, e -> {
|
Events.on(UnitCreateEvent.class, e -> {
|
||||||
if(campaign() && e.unit.team() == player.team()){
|
if(campaign() && e.unit.team() == player.team()){
|
||||||
@@ -214,13 +246,17 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(ResearchEvent.class, e -> {
|
Runnable checkUnlocks = () -> {
|
||||||
if(e.content == Blocks.router) researchRouter.complete();
|
if(Blocks.router.unlocked()) researchRouter.complete();
|
||||||
|
|
||||||
if(!TechTree.all.contains(t -> t.content.locked())){
|
if(!TechTree.all.contains(t -> t.content.locked())){
|
||||||
researchAll.complete();
|
researchAll.complete();
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
//check unlocked stuff on load as well
|
||||||
|
Events.on(ResearchEvent.class, e -> checkUnlocks.run());
|
||||||
|
Events.on(ClientLoadEvent.class, e -> checkUnlocks.run());
|
||||||
|
|
||||||
Events.on(WinEvent.class, e -> {
|
Events.on(WinEvent.class, e -> {
|
||||||
if(state.hasSector()){
|
if(state.hasSector()){
|
||||||
@@ -238,6 +274,8 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//TODO dead achievement
|
//TODO dead achievement
|
||||||
/*
|
/*
|
||||||
Events.on(MechChangeEvent.class, e -> {
|
Events.on(MechChangeEvent.class, e -> {
|
||||||
@@ -249,6 +287,11 @@ public class SStats implements SteamUserStatsCallback{
|
|||||||
});*/
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void save(){
|
||||||
|
Core.settings.putJson("units-built" , String.class, unitsBuilt);
|
||||||
|
Core.settings.putJson("blocks-built" , String.class, blocksBuilt);
|
||||||
|
}
|
||||||
|
|
||||||
private void trigger(Trigger trigger, SAchievement ach){
|
private void trigger(Trigger trigger, SAchievement ach){
|
||||||
Events.run(trigger, () -> {
|
Events.run(trigger, () -> {
|
||||||
if(campaign()){
|
if(campaign()){
|
||||||
|
|||||||
Reference in New Issue
Block a user