diff --git a/build.gradle b/build.gradle index 97595af258..5e896dbdf5 100644 --- a/build.gradle +++ b/build.gradle @@ -92,6 +92,8 @@ project(":desktop") { dependencies { compile project(":core") compile project(":kryonet") + if(new File(projectDir.parent, '../debug').exists()) compile project(":debug") + compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion" diff --git a/core/build.gradle b/core/build.gradle index 549dddef1e..abcec6d8f6 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,8 +1,4 @@ apply plugin: "java" sourceCompatibility = 1.8 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' -sourceSets.main.java.srcDirs = ["src/"] - -eclipse.project { - name = appName + "-core" -} +sourceSets.main.java.srcDirs = ["src/"] \ No newline at end of file diff --git a/core/src/io/anuke/mindustry/Mindustry.java b/core/src/io/anuke/mindustry/Mindustry.java index 2aea496d22..ce5c64e8bb 100644 --- a/core/src/io/anuke/mindustry/Mindustry.java +++ b/core/src/io/anuke/mindustry/Mindustry.java @@ -1,7 +1,9 @@ package io.anuke.mindustry; import io.anuke.mindustry.core.*; +import io.anuke.mindustry.game.EventType.GameLoadEvent; import io.anuke.mindustry.io.BundleLoader; +import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Timers; import io.anuke.ucore.modules.ModuleCore; import io.anuke.ucore.util.Log; @@ -32,6 +34,7 @@ public class Mindustry extends ModuleCore{ @Override public void postInit(){ Log.info("Time to load [total]: {0}", Timers.elapsed()); + Events.fire(new GameLoadEvent()); } @Override diff --git a/core/src/io/anuke/mindustry/game/EventType.java b/core/src/io/anuke/mindustry/game/EventType.java index 6b781a01e2..c6ed9f37fe 100644 --- a/core/src/io/anuke/mindustry/game/EventType.java +++ b/core/src/io/anuke/mindustry/game/EventType.java @@ -6,6 +6,10 @@ import io.anuke.ucore.function.Event; public class EventType{ + public static class GameLoadEvent implements Event{ + + } + public static class PlayEvent implements Event{ } diff --git a/desktop/build.gradle b/desktop/build.gradle index 99775d3be4..1c0e693bea 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -37,8 +37,12 @@ task run(dependsOn: classes, type: JavaExec) { jvmArgs "-XstartOnFirstThread" } ignoreExitValue = true - if (project.hasProperty("appArgs")) { - args Eval.me(appArgs) + if (project.hasProperty("args")) { + args Eval.me(project.getProperties()["args"]) + } + + if(args.contains("debug")){ + main = "io.anuke.mindustry.DebugLauncher" } } diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java index 0a122e7a6f..002357dab0 100644 --- a/server/src/io/anuke/mindustry/server/ServerControl.java +++ b/server/src/io/anuke/mindustry/server/ServerControl.java @@ -335,10 +335,10 @@ public class ServerControl extends Module{ info("Crash reporting is now {0}.", value ? "on" : "off"); }); - handler.register("debug", "", "Disables or enables debug mode", arg -> { + handler.register("strict", "", "Disables or enables strict mode", arg -> { boolean value = arg[0].equalsIgnoreCase("on"); - debug = value; - info("Debug mode is now {0}.", value ? "on" : "off"); + Settings.putBool("strict", value); + info("Debug mode is now {0}.", Settings.getBool("strict", true) ? "on" : "off"); }); handler.register("allow-custom-clients", "[on/off]", "Allow or disallow custom clients.", arg -> { @@ -903,7 +903,7 @@ public class ServerControl extends Module{ checkPvPGameOver(); } - if(state.is(State.playing) && world.getSector() != null && !inExtraRound && !debug){ + if(state.is(State.playing) && world.getSector() != null && !inExtraRound){ //all assigned missions are complete if(world.getSector().completedMissions >= world.getSector().missions.size){ Log.info("Mission complete."); diff --git a/settings.gradle b/settings.gradle index f0ebb1b115..f854ff03e2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,6 +10,10 @@ if(System.properties["release"] == null || System.properties["release"].equals(" include ':GDXGifRecorder' project(':GDXGifRecorder').projectDir = new File(settingsDir, '../GDXGifRecorder') } + if (new File(settingsDir, '../debug').exists()) { + include ':debug' + project(':debug').projectDir = new File(settingsDir, '../debug') + } }else{ println("Not including local repositories.") }