mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 23:11:12 -08:00
More achievement cleanup
This commit is contained in:
parent
23da62e374
commit
caec96615f
7 changed files with 84 additions and 29 deletions
|
|
@ -17,14 +17,12 @@ public class EventType{
|
|||
phaseDeflectHit,
|
||||
impactPower,
|
||||
thoriumReactorOverheat,
|
||||
itemLaunch,
|
||||
fireExtinguish,
|
||||
newGame,
|
||||
tutorialComplete,
|
||||
flameAmmo,
|
||||
turretCool,
|
||||
enablePixelation,
|
||||
drown,
|
||||
exclusionDeath,
|
||||
suicideBomb,
|
||||
openWiki,
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ public class SectorDamage{
|
|||
//first, calculate the total health of blocks in the path
|
||||
|
||||
//radius around the path that gets counted
|
||||
int radius = 9;
|
||||
int radius = 8;
|
||||
IntSet counted = new IntSet();
|
||||
|
||||
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
|
||||
info.sumHealth = sumHealth * 1.2f;
|
||||
//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.wavesSurvived = getWavesSurvived(info);
|
||||
|
|
|
|||
|
|
@ -374,6 +374,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||
stable.add("[accent]Difficulty: " + (int)(sector.baseCoverage * 10)).row();
|
||||
}
|
||||
|
||||
//TODO put most info in submenu
|
||||
|
||||
if(sector.isAttacked()){
|
||||
//TODO localize when finalized
|
||||
//these mechanics are likely to change and as such are not added to the bundle
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mindustry.world.blocks.units;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.scene.style.*;
|
||||
|
|
@ -12,6 +13,7 @@ import mindustry.*;
|
|||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
|
|
@ -33,6 +35,7 @@ public class CommandCenter extends Block{
|
|||
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
|
||||
build.team.data().command = command;
|
||||
effect.at(build);
|
||||
Events.fire(new CommandIssueEvent(build, command));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package mindustry.desktop.steam;
|
||||
|
||||
public enum SAchievement{
|
||||
completeTutorial,
|
||||
//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),
|
||||
win10Attack(SStat.attacksWon, 10),
|
||||
win10PvP(SStat.pvpsWon, 10),
|
||||
|
|
@ -43,8 +45,7 @@ public enum SAchievement{
|
|||
issueAttackCommand,
|
||||
active100Units(SStat.maxUnitActive, 100),
|
||||
build1000Units,
|
||||
//TODO
|
||||
buildAllUnits,
|
||||
buildAllUnits(SStat.unitsBuilt, 30),
|
||||
//TODO
|
||||
activeAllT5,
|
||||
dieExclusion,
|
||||
|
|
@ -55,9 +56,13 @@ public enum SAchievement{
|
|||
launchItemPad,
|
||||
chainRouters,
|
||||
//TODO
|
||||
circleConveyor,
|
||||
//TODO
|
||||
becomeRouter,
|
||||
//TODO
|
||||
save20Schematics,
|
||||
//TODO
|
||||
destroyEnemyBase,
|
||||
survive10WavesNoBlocks,
|
||||
useFlameAmmo,
|
||||
coolTurret,
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ public enum SStat{
|
|||
}
|
||||
}
|
||||
|
||||
public void add(int amount){
|
||||
SVars.stats.stats.setStatI(name(), get() + amount);
|
||||
public void set(int amount){
|
||||
SVars.stats.stats.setStatI(name(), amount);
|
||||
SVars.stats.onUpdate();
|
||||
|
||||
for(SAchievement a : SAchievement.all){
|
||||
|
|
@ -38,6 +38,10 @@ public enum SStat{
|
|||
}
|
||||
}
|
||||
|
||||
public void add(int amount){
|
||||
set(get() + 1);
|
||||
}
|
||||
|
||||
public void add(){
|
||||
add(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mindustry.desktop.steam;
|
||||
|
||||
import arc.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import com.codedisaster.steamworks.*;
|
||||
import mindustry.*;
|
||||
|
|
@ -8,6 +9,8 @@ import mindustry.content.*;
|
|||
import mindustry.entities.units.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.distribution.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
import static mindustry.desktop.steam.SAchievement.*;
|
||||
|
|
@ -20,6 +23,8 @@ public class SStats implements SteamUserStatsCallback{
|
|||
//private ObjectSet<String> mechs = new ObjectSet<>();
|
||||
private int statSavePeriod = 4; //in minutes
|
||||
|
||||
private ObjectSet<String> blocksBuilt = new ObjectSet<>(), unitsBuilt = new ObjectSet<>();
|
||||
|
||||
public SStats(){
|
||||
stats.requestCurrentStats();
|
||||
|
||||
|
|
@ -51,7 +56,7 @@ public class SStats implements SteamUserStatsCallback{
|
|||
|
||||
void checkUpdate(){
|
||||
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
|
||||
//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(){
|
||||
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 -> {
|
||||
if(ncustom()){
|
||||
if(e.unit.team != Vars.player.team()){
|
||||
|
|
@ -105,33 +115,47 @@ public class SStats implements SteamUserStatsCallback{
|
|||
chainRouters.complete();
|
||||
}
|
||||
|
||||
//TODO implement
|
||||
if(e.tile.block() == Blocks.groundFactory){
|
||||
buildGroundFactory.complete();
|
||||
}
|
||||
|
||||
//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(blocksBuilt.add(e.tile.block().name)){
|
||||
if(blocksBuilt.contains("meltdown") && blocksBuilt.contains("spectre") && blocksBuilt.contains("foreshadow")){
|
||||
buildMeltdownSpectreForeshadow.complete();
|
||||
}
|
||||
|
||||
if(e.tile.block() == Blocks.spectre){
|
||||
Core.settings.put("spectrep", true);
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
if(e.tile.block() == Blocks.foreshadow){
|
||||
Core.settings.put("spectrep", true);
|
||||
}
|
||||
if(e.tile.block() instanceof Conveyor){
|
||||
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)){
|
||||
//TODO
|
||||
//buildMeltdownSpectre.complete();
|
||||
if(current == e.tile){
|
||||
circleConveyor.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 -> {
|
||||
if(campaign() && e.tile.team() != player.team()){
|
||||
SStat.blocksDestroyed.add();
|
||||
|
|
@ -151,7 +175,11 @@ public class SStats implements SteamUserStatsCallback{
|
|||
|
||||
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);
|
||||
|
||||
|
|
@ -173,7 +201,11 @@ public class SStats implements SteamUserStatsCallback{
|
|||
|
||||
trigger(Trigger.phaseDeflectHit, killEnemyPhaseWall);
|
||||
|
||||
trigger(Trigger.itemLaunch, launchItemPad);
|
||||
Events.on(LaunchItemEvent.class, e -> {
|
||||
if(campaign()){
|
||||
launchItemPad.complete();
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(UnitCreateEvent.class, e -> {
|
||||
if(campaign() && e.unit.team() == player.team()){
|
||||
|
|
@ -214,13 +246,17 @@ public class SStats implements SteamUserStatsCallback{
|
|||
}
|
||||
});
|
||||
|
||||
Events.on(ResearchEvent.class, e -> {
|
||||
if(e.content == Blocks.router) researchRouter.complete();
|
||||
Runnable checkUnlocks = () -> {
|
||||
if(Blocks.router.unlocked()) researchRouter.complete();
|
||||
|
||||
if(!TechTree.all.contains(t -> t.content.locked())){
|
||||
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 -> {
|
||||
if(state.hasSector()){
|
||||
|
|
@ -238,6 +274,8 @@ public class SStats implements SteamUserStatsCallback{
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//TODO dead achievement
|
||||
/*
|
||||
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){
|
||||
Events.run(trigger, () -> {
|
||||
if(campaign()){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue