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

@@ -1772,7 +1772,7 @@ hint.payloadDrop.mobile = [accent]Tap and hold[] an empty location to drop a pay
hint.waveFire = [accent]Wave[] turrets with water as ammunition will automatically put out nearby fires. hint.waveFire = [accent]Wave[] turrets with water as ammunition will automatically put out nearby fires.
hint.generator = \uF879 [accent]Combustion Generators[] burn coal and transmit power to adjacent blocks.\n\nPower transmission range can be extended with \uF87F [accent]Power Nodes[]. hint.generator = \uF879 [accent]Combustion Generators[] burn coal and transmit power to adjacent blocks.\n\nPower transmission range can be extended with \uF87F [accent]Power Nodes[].
hint.guardian = [accent]Guardian[] units are armored. Weak ammo such as [accent]Copper[] and [accent]Lead[] is [scarlet]not effective[].\n\nUse higher tier turrets or \uF835 [accent]Graphite[] \uF861Duo/\uF859Salvo ammunition to take Guardians down. hint.guardian = [accent]Guardian[] units are armored. Weak ammo such as [accent]Copper[] and [accent]Lead[] is [scarlet]not effective[].\n\nUse higher tier turrets or \uF835 [accent]Graphite[] \uF861Duo/\uF859Salvo ammunition to take Guardians down.
hint.coreUpgrade = Cores can be upgraded by [accent]placing higher-tier cores over them[].\n\nPlace a \u00EF\u00A1\u00A8 [accent]Foundation[] core over the \u00EF\u00A1\u00A9 [accent]Shard[] core. Make sure it is free from nearby obstructions. hint.coreUpgrade = Cores can be upgraded by [accent]placing higher-tier cores over them[].\n\nPlace a \uf868 [accent]Foundation[] core over the \uf869 [accent]Shard[] core. Make sure it is free from nearby obstructions.
hint.presetLaunch = Gray [accent]landing zone sectors[], such as [accent]Frozen Forest[], can be launched to from anywhere. They do not require capture of nearby territory.\n\n[accent]Numbered sectors[], such as this one, are [accent]optional[]. hint.presetLaunch = Gray [accent]landing zone sectors[], such as [accent]Frozen Forest[], can be launched to from anywhere. They do not require capture of nearby territory.\n\n[accent]Numbered sectors[], such as this one, are [accent]optional[].
hint.presetDifficulty = This sector has a [scarlet]high enemy threat level[].\nLaunching to such sectors is [accent]not recommended[] without proper technology and preparation. hint.presetDifficulty = This sector has a [scarlet]high enemy threat level[].\nLaunching to such sectors is [accent]not recommended[] without proper technology and preparation.
hint.coreIncinerate = After the core is filled to capacity with an item, any extra items of that type it receives will be [accent]incinerated[]. hint.coreIncinerate = After the core is filled to capacity with an item, any extra items of that type it receives will be [accent]incinerated[].

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

View File

@@ -1201,10 +1201,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
} }
public void drawLight(){ 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 //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); visualLiquid = Mathf.lerpDelta(visualLiquid, liquids.get(liq)>= 0.01f ? 1f : 0f, 0.06f);
drawLiquidLight(liquids.current(), visualLiquid); drawLiquidLight(liq, visualLiquid);
} }
} }
@@ -1214,7 +1215,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
float fract = 1f; float fract = 1f;
float opacity = color.a * fract; float opacity = color.a * fract;
if(opacity > 0.001f){ 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. /** Handle a bullet collision.
* @return whether the bullet should be removed. */ * @return whether the bullet should be removed. */
public boolean collision(Bullet other){ public boolean collision(Bullet other){
boolean wasDead = dead(); boolean wasDead = health <= 0;
damage(other.team, other.damage() * other.type().buildingDamageMultiplier); damage(other.team, other.damage() * other.type().buildingDamageMultiplier);
Events.fire(bulletDamageEvent.set(self(), other)); Events.fire(bulletDamageEvent.set(self(), other));
if(dead() && !wasDead){ if(health <= 0 && !wasDead){
Events.fire(new BuildingBulletDestroyEvent(self(), other)); Events.fire(new BuildingBulletDestroyEvent(self(), other));
} }

View File

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

View File

@@ -16,6 +16,7 @@ import mindustry.world.blocks.defense.turrets.Turret.*;
import mindustry.world.blocks.distribution.*; import mindustry.world.blocks.distribution.*;
import mindustry.world.blocks.production.AttributeCrafter.*; import mindustry.world.blocks.production.AttributeCrafter.*;
import mindustry.world.blocks.production.SolidPump.*; import mindustry.world.blocks.production.SolidPump.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -54,6 +55,10 @@ public class GameService{
} }
public void clearAchievement(String name){
}
public boolean isAchieved(String name){ public boolean isAchieved(String name){
return false; 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); 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); 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); //cores are ignored since they're upgrades and can be skipped
allErekirBlocks = content.blocks().select(b -> b.synthetic() && 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 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); unitsBuilt = Core.settings.getJson("units-built" , ObjectSet.class, String.class, ObjectSet::new);
blocksBuilt = Core.settings.getJson("blocks-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(allBlocksErekir, allErekirBlocks);
checkAllBlocks(allBlocksSerpulo, allSerpuloBlocks); checkAllBlocks(allBlocksSerpulo, allSerpuloBlocks);
Log.info(Structs.find(allSerpuloBlocks, b -> !blocksBuilt.contains(b.name)));
//periodically check for various conditions //periodically check for various conditions
float updateInterval = 2f; float updateInterval = 2f;
Timer.schedule(this::checkUpdate, updateInterval, updateInterval); Timer.schedule(this::checkUpdate, updateInterval, updateInterval);
@@ -528,9 +536,10 @@ public class GameService{
for(var up : Groups.powerGraph){ for(var up : Groups.powerGraph){
var graph = up.graph(); 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; float balance = graph.getPowerBalance() * 60f;
if(balance < 10_000) negative10kPower.complete();
if(balance < -10_000) negative10kPower.complete();
if(balance > 100_000) positive100kPower.complete(); if(balance > 100_000) positive100kPower.complete();
if(graph.getBatteryStored() > 1_000_000) store1milPower.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; public float baseExplosiveness = 0f;
/** bullet that this block spawns when destroyed */ /** bullet that this block spawns when destroyed */
public @Nullable BulletType destroyBullet = null; public @Nullable BulletType destroyBullet = null;
/** liquid used for lighting */
public @Nullable Liquid lightLiquid;
/** whether cracks are drawn when this block is damaged */ /** whether cracks are drawn when this block is damaged */
public boolean drawCracks = true; public boolean drawCracks = true;
/** whether rubble is created when this block is destroyed */ /** 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 Sound shootSound = Sounds.bang;
public Color waveColor = Pal.accent, heatColor = Pal.turretHeat, shapeColor = Color.valueOf("f29c83"); public Color waveColor = Pal.accent, heatColor = Pal.turretHeat, shapeColor = Color.valueOf("f29c83");
public float cooldownMultiplier = 1f; public float cooldownMultiplier = 1f;
public Effect hitEffect = Fx.hitSquaresColor;
public Effect waveEffect = Fx.pointShockwave; public Effect waveEffect = Fx.pointShockwave;
//TODO switch to drawers eventually or something //TODO switch to drawers eventually or something
@@ -90,6 +91,7 @@ public class ShockwaveTower extends Block{
}else{ }else{
target.remove(); target.remove();
} }
hitEffect.at(target.x, target.y, waveColor);
} }
if(team == state.rules.defaultTeam){ if(team == state.rules.defaultTeam){

View File

@@ -147,6 +147,12 @@ public class DesktopLauncher extends ClientLauncher{
SVars.stats.stats.storeStats(); SVars.stats.stats.storeStats();
} }
@Override
public void clearAchievement(String name){
SVars.stats.stats.clearAchievement(name);
SVars.stats.stats.storeStats();
}
@Override @Override
public boolean isAchieved(String name){ public boolean isAchieved(String name){
return SVars.stats.stats.isAchieved(name, false); return SVars.stats.stats.isAchieved(name, false);