This commit is contained in:
Anuken
2020-07-23 10:27:24 -04:00
parent dc30ac4069
commit c93431ecc6
3 changed files with 32 additions and 1 deletions

View File

@@ -158,6 +158,19 @@ public class Control implements ApplicationListener, Loadable{
}
});
//delete save on campaign game over
Events.on(GameOverEvent.class, e -> {
if(state.isCampaign() && !net.client() && !headless){
//delete the save, it is gone.
if(saves.getCurrent() != null && !state.rules.tutorial){
Sector sector = state.getSector();
sector.save = null;
saves.getCurrent().delete();
}
}
});
Events.on(Trigger.newGame, () -> {
Building core = player.closestCore();

View File

@@ -5,6 +5,7 @@ import arc.util.serialization.Json.*;
import mindustry.content.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.io.legacy.*;
import mindustry.type.*;
import static mindustry.Vars.content;
@@ -93,7 +94,9 @@ public class SpawnGroup implements Serializable{
@Override
public void read(Json json, JsonValue data){
type = content.getByName(ContentType.unit, data.getString("type", "dagger"));
String tname = data.getString("type", "dagger");
type = content.getByName(ContentType.unit, LegacyIO.unitMap.get(tname, tname));
if(type == null) type = UnitTypes.dagger;
begin = data.getInt("begin", 0);
end = data.getInt("end", never);

View File

@@ -7,6 +7,21 @@ import mindustry.ui.dialogs.JoinDialog.*;
import java.io.*;
public class LegacyIO{
/** Maps old unit names to new ones. */
public static final StringMap unitMap = StringMap.of(
"titan", "mace",
"chaos-array", "vestige",
"eradicator", "cataclyst",
"eruptor", "atrax",
"wraith", "flare",
"ghoul", "horizon",
"revenant", "zenith",
"lich", "antumbra",
"reaper", "eclipse",
"draug", "mono",
"phantom", "poly",
"spirit", "poly"
);
public static Seq<Server> readServers(){
Seq<Server> arr = new Seq<>();