diff --git a/android/src/io/anuke/mindustry/AndroidLauncher.java b/android/src/io/anuke/mindustry/AndroidLauncher.java index 11ccfc62fb..5f233867ca 100644 --- a/android/src/io/anuke/mindustry/AndroidLauncher.java +++ b/android/src/io/anuke/mindustry/AndroidLauncher.java @@ -90,11 +90,6 @@ public class AndroidLauncher extends PatchedAndroidApplication{ return new DefaultThreadImpl(); } - @Override - public boolean isDebug(){ - return false; - } - @Override public String getUUID(){ try{ diff --git a/core/src/io/anuke/mindustry/Mindustry.java b/core/src/io/anuke/mindustry/Mindustry.java index 057755bcaa..2aea496d22 100644 --- a/core/src/io/anuke/mindustry/Mindustry.java +++ b/core/src/io/anuke/mindustry/Mindustry.java @@ -16,8 +16,6 @@ public class Mindustry extends ModuleCore{ Vars.init(); - debug = Platform.instance.isDebug(); - Log.setUseColors(false); BundleLoader.load(); content.load(); diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index ba1605bb6f..11c314337e 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -89,20 +89,7 @@ public class Vars{ public static float fontScale; //camera zoom displayed on startup public static int baseCameraScale; - //if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available - public static boolean debug = false; public static boolean console = false; - //whether the player can clip through walls - public static boolean noclip = false; - //whether turrets have infinite ammo (only with debug) - public static boolean infiniteAmmo = true; - //whether to show paths of enemies - public static boolean showPaths = false; - //if false, player is always hidden - public static boolean showPlayer = true; - //whether to hide ui, only on debug - public static boolean showUI = true; - //whether to show block debug public static boolean showBlockDebug = false; public static boolean showFog = true; public static boolean headless = false; diff --git a/core/src/io/anuke/mindustry/content/Recipes.java b/core/src/io/anuke/mindustry/content/Recipes.java index 1e63afc62f..f72922edb3 100644 --- a/core/src/io/anuke/mindustry/content/Recipes.java +++ b/core/src/io/anuke/mindustry/content/Recipes.java @@ -2,6 +2,7 @@ package io.anuke.mindustry.content; import io.anuke.mindustry.content.blocks.*; import io.anuke.mindustry.game.ContentList; +import io.anuke.mindustry.game.GameMode; import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.Recipe; @@ -175,11 +176,11 @@ public class Recipes implements ContentList{ new Recipe(liquid, LiquidBlocks.thermalPump, new ItemStack(Items.copper, 160), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 80), new ItemStack(Items.thorium, 70)); //DEBUG - new Recipe(units, DebugBlocks.itemSource).setDebug(); - new Recipe(units, DebugBlocks.itemVoid).setDebug(); - new Recipe(units, DebugBlocks.liquidSource).setDebug(); - new Recipe(units, DebugBlocks.powerVoid).setDebug(); - new Recipe(units, DebugBlocks.powerInfinite).setDebug(); + new Recipe(units, DebugBlocks.itemSource).setMode(GameMode.sandbox).setHidden(true); + new Recipe(units, DebugBlocks.itemVoid).setMode(GameMode.sandbox).setHidden(true); + new Recipe(units, DebugBlocks.liquidSource).setMode(GameMode.sandbox).setHidden(true); + new Recipe(units, DebugBlocks.powerVoid).setMode(GameMode.sandbox).setHidden(true); + new Recipe(units, DebugBlocks.powerInfinite).setMode(GameMode.sandbox).setHidden(true); } @Override diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index c71aa6eacf..cebfe70bf9 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -273,7 +273,7 @@ public class Control extends Module{ for(int i = 0; i < content.recipes().size; i ++){ Recipe recipe = content.recipes().get(i); - if(!recipe.debugOnly && recipe.requirements != null && entity.items.has(recipe.requirements, 1.4f)){ + if(!recipe.hidden && recipe.requirements != null && entity.items.has(recipe.requirements, 1.4f)){ if(control.database().unlockContent(recipe)){ ui.hudfrag.showUnlock(recipe); } @@ -351,7 +351,7 @@ public class Control extends Module{ throw new RuntimeException(error); } - if(debug && Inputs.keyTap(io.anuke.ucore.input.Input.GRAVE)){ + if(Inputs.keyTap(io.anuke.ucore.input.Input.GRAVE)){ console = !console; } @@ -391,8 +391,8 @@ public class Control extends Module{ if(!state.mode.infiniteResources && Timers.get("timerCheckUnlock", 120)){ checkUnlockableBlocks(); - //save if the db changed, but don't save in debug - if(db.isDirty() && !debug){ + //save if the db changed + if(db.isDirty()){ db.save(); } } diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index 6d2aeb34da..b3a0ad4692 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -10,9 +10,7 @@ import io.anuke.mindustry.game.EventType.ResetEvent; import io.anuke.mindustry.game.EventType.WaveEvent; import io.anuke.mindustry.game.Teams; import io.anuke.mindustry.net.Net; -import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.ItemStack; -import io.anuke.mindustry.type.ItemType; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Timers; @@ -49,14 +47,6 @@ public class Logic extends Module{ state.wavetime = wavespace * state.difficulty.timeScaling * 2; for(Tile tile : state.teams.get(defaultTeam).cores){ - if(debug){ - for(Item item : content.items()){ - if(item.type == ItemType.material){ - tile.entity.items.set(item, 1000); - } - } - } - if(world.getSector() != null){ Array items = world.getSector().startingItems; for(ItemStack stack : items){ diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index bb6233c9a6..a068d85ded 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -23,6 +23,7 @@ import io.anuke.mindustry.net.*; import io.anuke.mindustry.net.Administration.PlayerInfo; import io.anuke.mindustry.net.Packets.*; import io.anuke.mindustry.world.Tile; +import io.anuke.ucore.core.Settings; import io.anuke.ucore.core.Timers; import io.anuke.ucore.entities.Entities; import io.anuke.ucore.entities.EntityGroup; @@ -125,7 +126,7 @@ public class NetServer extends Module{ return; } - boolean preventDuplicates = headless && !debug; + boolean preventDuplicates = headless && isStrict(); if(preventDuplicates){ for(Player player : playerGroup.all()){ @@ -266,6 +267,10 @@ public class NetServer extends Module{ } } + public static boolean isStrict(){ + return Settings.getBool("strict", true); + } + public void sendWorldData(Player player, int clientID){ ByteArrayOutputStream stream = new ByteArrayOutputStream(); DeflaterOutputStream def = new DeflaterOutputStream(stream); @@ -302,7 +307,7 @@ public class NetServer extends Module{ NetConnection connection = player.con; if(connection == null || snapshotID < connection.lastRecievedClientSnapshot) return; - boolean verifyPosition = !player.isDead() && !debug && headless && player.getCarrier() == null; + boolean verifyPosition = !player.isDead() && isStrict() && headless && player.getCarrier() == null; if(connection.lastRecievedClientTime == 0) connection.lastRecievedClientTime = TimeUtils.millis() - 16; diff --git a/core/src/io/anuke/mindustry/core/Platform.java b/core/src/io/anuke/mindustry/core/Platform.java index c96f05440a..2cf96a85e0 100644 --- a/core/src/io/anuke/mindustry/core/Platform.java +++ b/core/src/io/anuke/mindustry/core/Platform.java @@ -41,8 +41,6 @@ public abstract class Platform { public String getLocaleName(Locale locale){ return locale.toString(); } - /**Whether debug mode is enabled.*/ - public boolean isDebug(){return false;} /**Must be a base64 string 8 bytes in length.*/ public String getUUID(){ String uuid = Settings.getString("uuid", ""); diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index 691db8990f..cba601fbcc 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -190,7 +190,7 @@ public class Renderer extends RendererModule{ camera.position.set(lastx - deltax, lasty - deltay, 0); } - if(debug && !ui.chatfrag.chatOpen()){ + if(!ui.chatfrag.chatOpen()){ renderer.record(); //this only does something if GdxGifRecorder is on the class path, which it usually isn't } } @@ -280,8 +280,6 @@ public class Renderer extends RendererModule{ EntityDraw.drawWith(shieldGroup, shield -> true, shield -> ((ShieldEntity)shield).drawOver()); Graphics.endShaders(); - if(showPaths && debug) drawDebug(); - Graphics.flushSurface(); batch.end(); diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index 42b0739e57..198c109618 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -123,8 +123,6 @@ public class UI extends SceneModule{ @Override public synchronized void update(){ - if(Vars.debug && !Vars.showUI) return; - if(Graphics.drawing()) Graphics.end(); act(); diff --git a/core/src/io/anuke/mindustry/editor/MapEditorDialog.java b/core/src/io/anuke/mindustry/editor/MapEditorDialog.java index ec42d720f2..7dcb5d81ee 100644 --- a/core/src/io/anuke/mindustry/editor/MapEditorDialog.java +++ b/core/src/io/anuke/mindustry/editor/MapEditorDialog.java @@ -568,15 +568,15 @@ public class MapEditorDialog extends Dialog implements Disposable{ for(Block block : Vars.content.blocks()){ TextureRegion[] regions = block.getCompactIcon(); if((block.synthetic() && (Recipe.getByResult(block) == null || !control.database().isUnlocked(Recipe.getByResult(block)))) - && !debug && block != StorageBlocks.core){ + && block != StorageBlocks.core){ continue; } - if(Recipe.getByResult(block) != null && Recipe.getByResult(block).debugOnly && !debug){ + if(Recipe.getByResult(block) != null){ continue; } - if(Recipe.getByResult(block) != null && Recipe.getByResult(block).desktopOnly && mobile && !debug){ + if(Recipe.getByResult(block) != null && Recipe.getByResult(block).desktopOnly && mobile){ continue; } diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 0182348c99..7daea8e4d8 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -266,7 +266,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra @Override public void draw(){ - if((debug && (!showPlayer || !showUI)) || dead) return; + if(dead) return; float x = snappedX(), y = snappedY(); @@ -518,7 +518,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra isBoosting = true; } - float speed = isBoosting && !mech.flying ? debug ? 5f : mech.boostSpeed : mech.speed; + float speed = isBoosting && !mech.flying ? mech.boostSpeed : mech.speed; //fraction of speed when at max load float carrySlowdown = 0.7f; @@ -570,7 +570,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra velocity.add(movement); } float prex = x, prey = y; - updateVelocityStatus(mech.drag, debug ? 10f : mech.maxSpeed); + updateVelocityStatus(mech.drag, mech.maxSpeed); moved = distanceTo(prex, prey) > 0.01f; }else{ velocity.setZero(); diff --git a/core/src/io/anuke/mindustry/game/ContentDatabase.java b/core/src/io/anuke/mindustry/game/ContentDatabase.java index a187045f30..8ec95cfdbc 100644 --- a/core/src/io/anuke/mindustry/game/ContentDatabase.java +++ b/core/src/io/anuke/mindustry/game/ContentDatabase.java @@ -9,8 +9,6 @@ import io.anuke.mindustry.type.ContentType; import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Settings; -import static io.anuke.mindustry.Vars.debug; - public class ContentDatabase{ /** Maps unlockable type names to a set of unlocked content.*/ private ObjectMap> unlocked = new ObjectMap<>(); @@ -23,7 +21,7 @@ public class ContentDatabase{ /** Returns whether or not this piece of content is unlocked yet.*/ public boolean isUnlocked(UnlockableContent content){ - if(debug) return true; + if(content.alwaysUnlocked()) return true; if(!unlocked.containsKey(content.getContentType())){ unlocked.put(content.getContentType(), new ObjectSet<>()); diff --git a/core/src/io/anuke/mindustry/game/UnlockableContent.java b/core/src/io/anuke/mindustry/game/UnlockableContent.java index 69235be861..ff6cd73498 100644 --- a/core/src/io/anuke/mindustry/game/UnlockableContent.java +++ b/core/src/io/anuke/mindustry/game/UnlockableContent.java @@ -24,6 +24,11 @@ public abstract class UnlockableContent extends MappableContent{ return false; } + /**Override to make content always unlocked.*/ + public boolean alwaysUnlocked(){ + return false; + } + /**Lists the content that must be unlocked in order for this specific content to become unlocked. May return null.*/ public UnlockableContent[] getDependencies(){ return null; diff --git a/core/src/io/anuke/mindustry/type/Recipe.java b/core/src/io/anuke/mindustry/type/Recipe.java index cccc3c84f4..1d484bc25e 100644 --- a/core/src/io/anuke/mindustry/type/Recipe.java +++ b/core/src/io/anuke/mindustry/type/Recipe.java @@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.badlogic.gdx.utils.OrderedMap; -import io.anuke.mindustry.Vars; +import io.anuke.mindustry.game.GameMode; import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.ui.ContentDisplay; import io.anuke.mindustry.world.Block; @@ -28,9 +28,11 @@ public class Recipe extends UnlockableContent{ public final Category category; public final float cost; - public boolean desktopOnly = false, debugOnly = false; + public boolean desktopOnly = false; //the only gamemode in which the recipe shows up + public GameMode mode; public boolean isPad; + public boolean hidden; private UnlockableContent[] dependencies; private Block[] blockDependencies; @@ -58,12 +60,12 @@ public class Recipe extends UnlockableContent{ */ public static void getUnlockedByCategory(Category category, Array r){ if(headless){ - throw new RuntimeException("Not enabled on the headless backend!"); + throw new RuntimeException("Not implemented on the headless backend!"); } r.clear(); for(Recipe recipe : content.recipes()){ - if(recipe.category == category && (Vars.control.database().isUnlocked(recipe) || (debug && recipe.debugOnly))){ + if(recipe.category == category && (control.database().isUnlocked(recipe))){ r.add(recipe); } } @@ -95,14 +97,24 @@ public class Recipe extends UnlockableContent{ return this; } - public Recipe setDebug(){ - debugOnly = true; + public Recipe setMode(GameMode mode){ + this.mode = mode; + return this; + } + + public Recipe setHidden(boolean hidden){ + this.hidden = hidden; return this; } + @Override + public boolean alwaysUnlocked(){ + return hidden; + } + @Override public boolean isHidden(){ - return debugOnly || (desktopOnly && mobile); + return (desktopOnly && mobile) || hidden; } @Override diff --git a/core/src/io/anuke/mindustry/ui/dialogs/SectorsDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/SectorsDialog.java index 5e5399b8c2..dd532199b8 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/SectorsDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/SectorsDialog.java @@ -54,10 +54,6 @@ public class SectorsDialog extends FloatingDialog{ ui.loadLogic(() -> world.sectors().playSector(selected)); }).size(230f, 64f).disabled(b -> selected == null) .update(t -> t.setText(selected != null && selected.hasSave() ? "$text.sector.resume" : "$text.sector.deploy")); - - if(debug){ - buttons().addButton("unlock", () -> world.sectors().completeSector(selected.x, selected.y)).size(230f, 64f).disabled(b -> selected == null); - } } void selectSector(Sector sector){ diff --git a/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java b/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java index 30892eb4ac..1a4f6107c9 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java @@ -171,7 +171,7 @@ public class BlocksFragment extends Fragment{ //add actual recipes for(Recipe r : recipes){ - if((r.debugOnly && !debug) || (r.desktopOnly && mobile) || (r.isPad && !state.mode.showPads)) continue; + if((r.mode != null && r.mode != state.mode) || (r.desktopOnly && mobile) || (r.isPad && !state.mode.showPads)) continue; ImageButton image = new ImageButton(new TextureRegion(), "select"); diff --git a/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java b/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java index ef2022f416..321eb3cfc3 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java @@ -1,45 +1,16 @@ package io.anuke.mindustry.ui.fragments; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.files.FileHandle; -import io.anuke.mindustry.content.bullets.TurretBullets; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.entities.bullet.Bullet; -import io.anuke.mindustry.entities.units.BaseUnit; -import io.anuke.mindustry.entities.units.UnitType; -import io.anuke.mindustry.game.Team; import io.anuke.mindustry.net.Net; -import io.anuke.mindustry.type.ContentType; -import io.anuke.mindustry.ui.dialogs.FloatingDialog; -import io.anuke.mindustry.ui.dialogs.GenViewDialog; import io.anuke.ucore.core.Timers; import io.anuke.ucore.entities.EntityGroup; import io.anuke.ucore.scene.Group; -import io.anuke.ucore.scene.style.TextureRegionDrawable; import io.anuke.ucore.scene.ui.Label; -import io.anuke.ucore.scene.ui.layout.Table; -import io.anuke.ucore.util.Log; -import io.anuke.ucore.util.Log.LogHandler; -import io.anuke.ucore.util.Mathf; import static io.anuke.mindustry.Vars.*; public class DebugFragment extends Fragment{ - private static StringBuilder log = new StringBuilder(); - - static{ - Log.setLogger(new LogHandler(){ - @Override - public void print(String text, Object... args){ - super.print(text, args); - if(log.length() < 1000){ - log.append(Log.format(text, args)); - log.append("\n"); - } - } - }); - } public static String debugInfo(){ int totalUnits = 0; @@ -112,61 +83,6 @@ public class DebugFragment extends Fragment{ @Override public void build(Group parent){ - - Player player = players[0]; - parent.fill(c -> { - c.bottom().left().visible(() -> debug); - - c.table("pane", t -> { - t.defaults().fillX().width(100f); - - t.label(() -> Gdx.app.getJavaHeap() / 1024 / 1024 + "MB"); - t.row(); - - t.add("Debug"); - t.row(); - t.addButton("map", () -> new GenViewDialog().show()); - t.row(); - t.addButton("fire", () -> { - for (int i = 0; i < 20; i++) { - Bullet.create(TurretBullets.fireball, player, player.x, player.y, Mathf.random(360f)); - } - }); - t.row(); - t.addButton("team", "toggle", player::toggleTeam); - t.row(); - t.addButton("blocks", "toggle", () -> showBlockDebug = !showBlockDebug); - t.row(); - t.addButton("fog", () -> showFog = !showFog); - t.row(); - t.addButton("gameover", () -> { - state.teams.get(Team.blue).cores.get(0).entity.health = 0; - state.teams.get(Team.blue).cores.get(0).entity.damage(1); - }); - t.row(); - t.addButton("wave", () -> state.wavetime = 0f); - t.row(); - t.addButton("death", () -> player.damage(99999, true)); - t.row(); - t.addButton("spawn", () -> { - FloatingDialog dialog = new FloatingDialog("debug spawn"); - for(UnitType type : content.getBy(ContentType.unit)){ - dialog.content().addImageButton("white", 40, () -> { - BaseUnit unit = type.create(player.getTeam()); - unit.setWave(); - unit.set(player.x, player.y); - unit.add(); - }).get().getStyle().imageUp = new TextureRegionDrawable(type.iconRegion); - } - dialog.addCloseButton(); - dialog.setFillParent(false); - dialog.show(); - }); - t.row(); - }); - }); - - parent.fill(t -> { t.top().left().visible(() -> console); @@ -174,28 +90,7 @@ public class DebugFragment extends Fragment{ p.defaults().fillX(); p.pane("clear", new Label(DebugFragment::debugInfo)); - p.row(); - p.addButton("dump", () -> { - try{ - FileHandle file = Gdx.files.local("packet-dump.txt"); - file.writeString("--INFO--\n", false); - file.writeString(debugInfo(), true); - file.writeString("--LOG--\n\n", true); - file.writeString(log.toString(), true); - }catch(Exception e){ - ui.showError("Error dumping log."); - } - }); }); }); - - parent.fill(t -> { - t.top().visible(() -> console); - - Table table = new Table("pane"); - table.label(() -> log.toString()); - - t.pane("clear", table); - }); } } diff --git a/core/src/io/anuke/mindustry/world/Build.java b/core/src/io/anuke/mindustry/world/Build.java index b7f83ce57e..5e10ad54c6 100644 --- a/core/src/io/anuke/mindustry/world/Build.java +++ b/core/src/io/anuke/mindustry/world/Build.java @@ -109,7 +109,7 @@ public class Build{ public static boolean validPlace(Team team, int x, int y, Block type, int rotation){ Recipe recipe = Recipe.getByResult(type); - if(recipe == null || (recipe.debugOnly && !debug)){ + if(recipe == null || (recipe.mode != null && recipe.mode != state.mode)){ return false; } diff --git a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java index 5b8f994394..df737a34a7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java @@ -213,7 +213,7 @@ public class BuildBlock extends Block{ builderID = builder.getID(); } - if(progress >= 1f || debug || state.mode.infiniteResources){ + if(progress >= 1f || state.mode.infiniteResources){ Call.onConstructFinish(tile, recipe.result, builderID, tile.getRotation(), builder.getTeam()); } } @@ -244,7 +244,7 @@ public class BuildBlock extends Block{ progress = Mathf.clamp(progress - amount); - if(progress <= 0 || debug || state.mode.infiniteResources){ + if(progress <= 0 || state.mode.infiniteResources){ Call.onDeconstructFinish(tile, this.recipe == null ? previous : this.recipe.result); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java index 3121dd052a..56b24200ed 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java @@ -97,11 +97,6 @@ public class CoreBlock extends StorageBlock{ topRegion = Draw.region(name + "-top"); } - @Override - public float handleDamage(Tile tile, float amount){ - return debug ? 0 : amount; - } - @Override public void draw(Tile tile){ CoreEntity entity = tile.entity(); @@ -200,11 +195,6 @@ public class CoreBlock extends StorageBlock{ entity.time += entity.delta(); entity.progress += 1f / (entity.currentUnit instanceof Player ? state.mode.respawnTime : droneRespawnDuration) * entity.delta(); - //instant build for fast testing. - if(debug){ - entity.progress = 1f; - } - if(entity.progress >= 1f){ Call.onUnitRespawn(tile, entity.currentUnit); } diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java index 170b788ce2..59a5bead8e 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java @@ -15,11 +15,9 @@ import io.anuke.mindustry.game.GameMode; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.ui.dialogs.FileChooser; import io.anuke.ucore.function.Consumer; -import io.anuke.ucore.util.Log; import io.anuke.ucore.util.OS; import io.anuke.ucore.util.Strings; -import java.io.File; import java.net.NetworkInterface; import java.text.DateFormat; import java.text.NumberFormat; @@ -39,7 +37,7 @@ public class DesktopPlatform extends Platform{ public DesktopPlatform(String[] args){ this.args = args; - Vars.testMobile = isDebug() && Array.with(args).contains("-testMobile", false); + Vars.testMobile = Array.with(args).contains("-testMobile", false); if(useDiscord){ DiscordEventHandlers handlers = new DiscordEventHandlers(); @@ -117,14 +115,6 @@ public class DesktopPlatform extends Platform{ if(useDiscord) DiscordRPC.INSTANCE.Discord_Shutdown(); } - @Override - public boolean isDebug(){ - //honestly I'm just putting this ridiculous """anti-debug""" mess here to see if anyone bothers solving it without editing source - boolean eq = args.length > 0 && args[0].equals(("-debug_12312333_" + System.getProperty("os.arch") + "nice" + (int)(Math.sin(System.getProperty("user.dir").hashCode()) * 100) + Thread.currentThread().getStackTrace()[1].toString()).hashCode() + "") && new File("../../desktop/build/").exists(); - if(eq) Log.info("--DEBUG MODE ACTIVE--"); - return eq; - } - @Override public ThreadProvider getThreadProvider(){ return new DefaultThreadImpl();