Moved pref saving to specific locations

This commit is contained in:
Anuken 2020-07-02 10:20:16 -04:00
parent 5f6c71b9d3
commit fd2deb0a82
15 changed files with 53 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 313 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 MiB

After

Width:  |  Height:  |  Size: 1 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 MiB

After

Width:  |  Height:  |  Size: 1 MiB

Before After
Before After

View file

@ -327,6 +327,7 @@ public class Vars implements Loadable{
settings.defaults("locale", "default", "blocksync", true);
keybinds.setDefaults(Binding.values());
settings.setAutosave(false);
settings.load();
Scl.setProduct(settings.getInt("uiscale", 100) / 100f);

View file

@ -178,6 +178,7 @@ public class Control implements ApplicationListener, Loadable{
Effects.shake(5f, 5f, core);
});
});
}
@Override

View file

@ -96,7 +96,6 @@ public class Logic implements ApplicationListener{
//SectorDamage.apply(seconds);
//}
//add resources based on turns passed
if(state.rules.sector.save != null && core != null){
@ -126,6 +125,9 @@ public class Logic implements ApplicationListener{
//enable infinite ammo for wave team by default
state.rules.waveTeam.rules().infiniteAmmo = true;
//save settings
Core.settings.manualSave();
});
}
@ -161,6 +163,9 @@ public class Logic implements ApplicationListener{
Groups.all.clear();
Time.clear();
Events.fire(new ResetEvent());
//save settings on reset
Core.settings.manualSave();
}
public void runWave(){
@ -295,6 +300,12 @@ public class Logic implements ApplicationListener{
netClient.setQuiet();
}
@Override
public void dispose(){
//save the settings before quitting
Core.settings.manualSave();
}
@Override
public void update(){
Events.fire(Trigger.update);

View file

@ -18,6 +18,7 @@ import java.io.*;
import java.text.*;
import java.util.*;
import static arc.Core.*;
import static mindustry.Vars.net;
public class CrashSender{
@ -39,6 +40,11 @@ public class CrashSender{
try{
exception.printStackTrace();
//try saving game data
try{
settings.manualSave();
}catch(Throwable ignored){}
//don't create crash logs for custom builds, as it's expected
if(Version.build == -1 || (System.getProperty("user.name").equals("anuke") && "release".equals(Version.modifier))){
ret();

View file

@ -293,11 +293,11 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stable.table(t -> {
t.left();
sector.save.meta.secinfo.exportRates().each(entry -> {
int total = (int)(entry.value * eventRate / 60f);
sector.save.meta.secinfo.production.each((item, stat) -> {
int total = (int)(stat.mean * 60);
if(total > 1){
t.image(entry.key.icon(Cicon.small)).padRight(3);
t.add(ui.formatAmount(total) + " /turn").color(Color.lightGray);
t.image(item.icon(Cicon.small)).padRight(3);
t.add(ui.formatAmount(total) + " /min").color(Color.lightGray);
t.row();
}
});

View file

@ -17,12 +17,12 @@ public class SurgeWall extends Wall{
public class SurgeEntity extends Building{
@Override
public boolean collision(Bullet bullet){
super.collision(bullet);
if(Mathf.chance(lightningChance)){
Lightning.create(team(), Pal.surge, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength);
}
return true;
return super.collision(bullet);
}
}
}

View file

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=0582cfd3b405d534c948383578c7a3f0c0d9dd6b
archash=95c135917655b61d636292ba9dfd05766019c1d8

View file

@ -16,7 +16,7 @@ import mindustry.net.*;
import java.time.*;
import static arc.util.Log.format;
import static arc.util.Log.*;
import static mindustry.Vars.*;
import static mindustry.server.ServerControl.*;
@ -86,4 +86,5 @@ public class ServerLauncher implements ApplicationListener{
Events.fire(new ServerLoadEvent());
}
}

View file

@ -357,7 +357,7 @@ task pack(dependsOn: classes){
//antialias everything except UI elements
fileTree(dir: '../core/assets-raw/sprites_out/', include: "**/*.png").visit{ file ->
if(file.isDirectory() || (file.toString().replace("\\", "/").contains("/ui/") && file.toString().startsWith("icon-"))) return
if(file.isDirectory() || (file.toString().replace("\\", "/").contains("/ui/") && file.toString().startsWith("icon-")) || file.toString().contains(".9.png")) return
executor.submit{
antialias(file.file)

View file

@ -23,10 +23,33 @@ import mindustry.world.blocks.legacy.*;
import static mindustry.Vars.*;
public class Generators{
//used for changing colors in the UI - testing only
static final IntIntMap paletteMap = IntIntMap.with(
//empty for now
0x454545ff, 0x00000000,//0x32394bff,
0x00000099, 0x00000000//0x000000ff
);
public static void generate(){
ObjectMap<Block, Image> gens = new ObjectMap<>();
if(!paletteMap.isEmpty()){
ImagePacker.generate("uipalette", () -> {
Fi.get("../ui").walk(fi -> {
if(!fi.extEquals("png")) return;
Pixmap pix = new Pixmap(fi);
pix.setBlending(Pixmap.Blending.sourceOver);
pix.each((x, y) -> {
int value = pix.getPixel(x, y);
pix.draw(x, y, paletteMap.get(value, value));
});
fi.writePNG(pix);
});
});
}
ImagePacker.generate("splashes", () -> {
ArcNativesLoader.load();