Tested and fixed Steam achievements

This commit is contained in:
Anuken
2022-11-03 11:37:37 -04:00
parent b1be360180
commit b8e245f945
8 changed files with 85 additions and 61 deletions

View File

@@ -1004,6 +1004,7 @@ public class Blocks{
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.water), new DrawLiquidTile(Liquids.cryofluid){{drawLiquidLight = true;}}, new DrawDefault());
liquidCapacity = 24f;
craftTime = 120;
lightLiquid = Liquids.cryofluid;
consumePower(1f);
consumeItem(Items.titanium);
@@ -1863,6 +1864,8 @@ public class Blocks{
size = 3;
consumeLiquids(LiquidStack.with(Liquids.cyanogen, 1.5f / 60f));
consumePower(100f / 60f);
range = 170f;
reload = 80f;
}};
//TODO 5x5??
@@ -2550,6 +2553,9 @@ public class Blocks{
liquidCapacity = 30f;
explosionMinWarmup = 0.5f;
explosionRadius = 17;
explosionDamage = 2500;
ambientSound = Sounds.flux;
ambientSoundVolume = 0.13f;
@@ -2592,8 +2598,8 @@ public class Blocks{
itemDuration = 60f * 3f;
itemCapacity = 10;
explosionRadius = 7;
explosionDamage = 1000;
explosionRadius = 9;
explosionDamage = 2000;
explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Liquids.neoplasm.color), Fx.neoplasmSplat);
explodeSound = Sounds.largeExplosion;

View File

@@ -1201,10 +1201,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
public void drawLight(){
if(block.hasLiquids && block.drawLiquidLight && liquids.current().lightColor.a > 0.001f){
Liquid liq = block.hasLiquids && block.lightLiquid == null ? liquids.current() : block.lightLiquid;
if(block.hasLiquids && block.drawLiquidLight && liq.lightColor.a > 0.001f){
//yes, I am updating in draw()... but this is purely visual anyway, better have it here than in update() where it wastes time
visualLiquid = Mathf.lerpDelta(visualLiquid, liquids.currentAmount(), 0.07f);
drawLiquidLight(liquids.current(), visualLiquid);
visualLiquid = Mathf.lerpDelta(visualLiquid, liquids.get(liq)>= 0.01f ? 1f : 0f, 0.06f);
drawLiquidLight(liq, visualLiquid);
}
}
@@ -1214,7 +1215,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
float fract = 1f;
float opacity = color.a * fract;
if(opacity > 0.001f){
Drawf.light(x, y, block.size * 30f * fract, color, opacity);
Drawf.light(x, y, block.size * 30f * fract, color, opacity * amount);
}
}
}
@@ -1590,12 +1591,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
/** Handle a bullet collision.
* @return whether the bullet should be removed. */
public boolean collision(Bullet other){
boolean wasDead = dead();
boolean wasDead = health <= 0;
damage(other.team, other.damage() * other.type().buildingDamageMultiplier);
Events.fire(bulletDamageEvent.set(self(), other));
if(dead() && !wasDead){
if(health <= 0 && !wasDead){
Events.fire(new BuildingBulletDestroyEvent(self(), other));
}

View File

@@ -17,7 +17,7 @@ public enum Achievement{
launch30Times(SStat.timesLaunched, 30),
captureBackground,
survive100Waves(SStat.maxWavesSurvived, 100),
researchAll, //TODO - remake/change?
researchAll,
shockWetEnemy,
killEnemyPhaseWall,
researchRouter,
@@ -36,7 +36,7 @@ public enum Achievement{
obtainTitanium,
suicideBomb,
buildGroundFactory,
issueAttackCommand, //TODO - test
issueAttackCommand,
active100Units(SStat.maxUnitActive, 100),
build1000Units(SStat.unitsBuilt, 1000),
buildAllUnits(SStat.unitTypesBuilt, 30),
@@ -53,71 +53,62 @@ public enum Achievement{
circleConveyor,
becomeRouter,
create20Schematics(SStat.schematicsCreated, 20),
create500Schematics(SStat.schematicsCreated, 500), //TODO - test
create500Schematics(SStat.schematicsCreated, 500),
survive10WavesNoBlocks,
captureNoBlocksBroken,
useFlameAmmo,
coolTurret,
enablePixelation,
openWiki,
allTransportOneMap,
buildOverdriveProjector,
buildMendProjector,
buildWexWater,
//TODO new ones
have10mItems(SStat.totalCampaignItems, 10_000_000),
killEclipseDuo,
allTransportOneMap, //TODO - test
buildOverdriveProjector, //TODO - test
buildMendProjector, //TODO - test
buildWexWater, //TODO - test
completeErekir,
completeSerpulo,
have10mItems(SStat.totalCampaignItems, 10_000_000), //TODO - test
killEclipseDuo, //TODO - test
launchCoreSchematic,
nucleusGroundZero,
completeErekir, //TODO - test
completeSerpulo, //TODO - test
neoplasmWater,
blastFrozenUnit,
launchCoreSchematic, //TODO - test
nucleusGroundZero, //TODO - test
allBlocksSerpulo,
allBlocksErekir,
neoplasmWater, //TODO - test
blastFrozenUnit, //TODO - test
breakForceProjector,
researchLogic,
allBlocksSerpulo, //TODO - test
allBlocksErekir, //TODO - test
negative10kPower,
positive100kPower,
store1milPower,
//TODO are these necessary?
//allTurretsSerpulo, //TODO
//allTurretsErekir, //TODO
//allTechSerpulo, //TODO
//allTechErekir, //TODO
blastGenerator,
neoplasiaExplosion,
breakForceProjector, //TODO - test
researchLogic, //TODO - Steam - test
installMod,
routerLanguage,
joinCommunityServer,
openConsole,
negative10kPower, //TODO - test
positive100kPower, //TODO - test
store1milPower, //TODO - test
controlTurret,
dropUnitsCoreZone,
destroyScatterFlare,
boostUnit,
boostBuildingFloor,
blastGenerator, //TODO - test
neoplasiaExplosion, //TODO - test
hoverUnitLiquid,
installMod, //TODO - test
routerLanguage, //TODO - test
joinCommunityServer, //TODO - test
openConsole, //TODO - test
break100Boulders(SStat.bouldersDeconstructed, 100),
break10000Boulders(SStat.bouldersDeconstructed, 10_000),
controlTurret, //TODO - test
dropUnitsCoreZone, //TODO - test
destroyScatterFlare, //TODO - test
boostUnit, //TODO - test
boostBuildingFloor, //TODO - test
shockwaveTowerUse,
hoverUnitLiquid, //TODO - test
break100Boulders(SStat.bouldersDeconstructed, 100), //TODO - test
break10000Boulders(SStat.bouldersDeconstructed, 10_000), //TODO - test
shockwaveTowerUse, //TODO - test
useAnimdustryEmoji, //TODO - Steam - icon done
useAnimdustryEmoji,
;
@@ -140,7 +131,7 @@ public enum Achievement{
public void complete(){
if(!isAchieved()){
//can't complete achievements with the dev console shown.
if(ui != null && ui.consolefrag != null && ui.consolefrag.shown() && !OS.username.equals("anuke")) return;
if(ui != null && ui.consolefrag != null && ui.consolefrag.shown() && !OS.username.equals("anuke") && this != openConsole) return;
service.completeAchievement(name());
service.storeStats();
@@ -148,6 +139,13 @@ public enum Achievement{
}
}
public void uncomplete(){
if(isAchieved()){
service.clearAchievement(name());
completed = false;
}
}
public void checkCompletion(){
if(!isAchieved() && stat != null && stat.get() >= statGoal){
complete();

View File

@@ -16,6 +16,7 @@ import mindustry.world.blocks.defense.turrets.Turret.*;
import mindustry.world.blocks.distribution.*;
import mindustry.world.blocks.production.AttributeCrafter.*;
import mindustry.world.blocks.production.SolidPump.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
@@ -54,6 +55,10 @@ public class GameService{
}
public void clearAchievement(String name){
}
public boolean isAchieved(String name){
return false;
}
@@ -80,8 +85,9 @@ public class GameService{
allTransportSerpulo = content.blocks().select(b -> b.category == Category.distribution && b.isVisibleOn(Planets.serpulo) && b.isVanilla() && b.buildVisibility == BuildVisibility.shown).toArray(Block.class);
allTransportErekir = content.blocks().select(b -> b.category == Category.distribution && b.isVisibleOn(Planets.erekir) && b.isVanilla() && b.buildVisibility == BuildVisibility.shown).toArray(Block.class);
allSerpuloBlocks = content.blocks().select(b -> b.synthetic() && b.isVisibleOn(Planets.serpulo) && b.isVanilla() && b.buildVisibility == BuildVisibility.shown).toArray(Block.class);
allErekirBlocks = content.blocks().select(b -> b.synthetic() && b.isVisibleOn(Planets.erekir) && b.isVanilla() && b.buildVisibility == BuildVisibility.shown).toArray(Block.class);
//cores are ignored since they're upgrades and can be skipped
allSerpuloBlocks = content.blocks().select(b -> b.synthetic() && b.isVisibleOn(Planets.serpulo) && b.isVanilla() && !(b instanceof CoreBlock) && b.buildVisibility == BuildVisibility.shown).toArray(Block.class);
allErekirBlocks = content.blocks().select(b -> b.synthetic() && b.isVisibleOn(Planets.erekir) && b.isVanilla() && !(b instanceof CoreBlock) && b.buildVisibility == BuildVisibility.shown).toArray(Block.class);
unitsBuilt = Core.settings.getJson("units-built" , ObjectSet.class, String.class, ObjectSet::new);
blocksBuilt = Core.settings.getJson("blocks-built" , ObjectSet.class, String.class, ObjectSet::new);
@@ -90,6 +96,8 @@ public class GameService{
checkAllBlocks(allBlocksErekir, allErekirBlocks);
checkAllBlocks(allBlocksSerpulo, allSerpuloBlocks);
Log.info(Structs.find(allSerpuloBlocks, b -> !blocksBuilt.contains(b.name)));
//periodically check for various conditions
float updateInterval = 2f;
Timer.schedule(this::checkUpdate, updateInterval, updateInterval);
@@ -528,9 +536,10 @@ public class GameService{
for(var up : Groups.powerGraph){
var graph = up.graph();
if(graph.all.size > 0 && graph.all.first().team == player.team() && graph.hasPowerBalanceSamples()){
if(graph.all.size > 1 && graph.all.first().team == player.team() && graph.hasPowerBalanceSamples()){
float balance = graph.getPowerBalance() * 60f;
if(balance < 10_000) negative10kPower.complete();
if(balance < -10_000) negative10kPower.complete();
if(balance > 100_000) positive100kPower.complete();
if(graph.getBatteryStored() > 1_000_000) store1milPower.complete();
}

View File

@@ -166,6 +166,8 @@ public class Block extends UnlockableContent implements Senseable{
public float baseExplosiveness = 0f;
/** bullet that this block spawns when destroyed */
public @Nullable BulletType destroyBullet = null;
/** liquid used for lighting */
public @Nullable Liquid lightLiquid;
/** whether cracks are drawn when this block is damaged */
public boolean drawCracks = true;
/** whether rubble is created when this block is destroyed */

View File

@@ -31,6 +31,7 @@ public class ShockwaveTower extends Block{
public Sound shootSound = Sounds.bang;
public Color waveColor = Pal.accent, heatColor = Pal.turretHeat, shapeColor = Color.valueOf("f29c83");
public float cooldownMultiplier = 1f;
public Effect hitEffect = Fx.hitSquaresColor;
public Effect waveEffect = Fx.pointShockwave;
//TODO switch to drawers eventually or something
@@ -90,6 +91,7 @@ public class ShockwaveTower extends Block{
}else{
target.remove();
}
hitEffect.at(target.x, target.y, waveColor);
}
if(team == state.rules.defaultTeam){