From 2bc63b37e477026d2728e734444f979a481bf82d Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 9 Jan 2019 11:49:28 -0500 Subject: [PATCH] Bugfixes --- core/src/io/anuke/mindustry/core/Control.java | 27 ------------------- .../src/io/anuke/mindustry/core/Platform.java | 2 -- .../mindustry/desktop/DesktopPlatform.java | 10 +++---- 3 files changed, 3 insertions(+), 36 deletions(-) diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 3483e52fe2..3cae7a2327 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -222,35 +222,8 @@ public class Control implements ApplicationListener{ return hiscore; } - private void checkUnlockableBlocks(){ - TileEntity entity = players[0].getClosestCore(); - - if(entity == null) return; - - entity.items.forEach((item, amount) -> data.unlockContent(item)); - - if(players[0].inventory.hasItem()){ - data.unlockContent(players[0].inventory.getItem().item); - } - - outer: - for(int i = 0; i < content.recipes().size; i ++){ - Recipe recipe = content.recipes().get(i); - if(!recipe.isHidden() && recipe.requirements != null){ - for(ItemStack stack : recipe.requirements){ - if(!entity.items.has(stack.item, Math.min((int) (stack.amount), 2000))) continue outer; - } - - if(data.unlockContent(recipe)){ - ui.hudfrag.showUnlock(recipe); - } - } - } - } - @Override public void dispose(){ - Platform.instance.onGameExit(); content.dispose(); Net.dispose(); ui.editor.dispose(); diff --git a/core/src/io/anuke/mindustry/core/Platform.java b/core/src/io/anuke/mindustry/core/Platform.java index 049e262da1..999c57fa7f 100644 --- a/core/src/io/anuke/mindustry/core/Platform.java +++ b/core/src/io/anuke/mindustry/core/Platform.java @@ -38,8 +38,6 @@ public abstract class Platform { } /**Update discord RPC.*/ public void updateRPC(){} - /**Called when the game is exited.*/ - public void onGameExit(){} /**Open donation dialog. Currently android only.*/ public void openDonations(){} /**Whether donating is supported.*/ diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java index 59fd39501a..9dcbe0c00c 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java @@ -9,7 +9,6 @@ import io.anuke.arc.function.Consumer; import io.anuke.arc.util.OS; import io.anuke.arc.util.Strings; import io.anuke.arc.util.serialization.Base64Coder; -import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.game.GameMode; @@ -29,11 +28,13 @@ public class DesktopPlatform extends Platform{ public DesktopPlatform(String[] args){ this.args = args; - Vars.testMobile = Array.with(args).contains("-testMobile", false); + testMobile = Array.with(args).contains("-testMobile"); if(useDiscord){ DiscordEventHandlers handlers = new DiscordEventHandlers(); DiscordRPC.INSTANCE.Discord_Initialize(applicationId, handlers, true, ""); + + Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC.INSTANCE::Discord_Shutdown)); } } @@ -84,11 +85,6 @@ public class DesktopPlatform extends Platform{ DiscordRPC.INSTANCE.Discord_UpdatePresence(presence); } - @Override - public void onGameExit(){ - if(useDiscord) DiscordRPC.INSTANCE.Discord_Shutdown(); - } - @Override public String getUUID(){ try{