Removed debug mode / Added source blocks to sandbox

This commit is contained in:
Anuken
2018-09-10 17:46:32 -04:00
parent 2da0862cb2
commit 4af0fbf553
22 changed files with 54 additions and 198 deletions

View File

@@ -90,11 +90,6 @@ public class AndroidLauncher extends PatchedAndroidApplication{
return new DefaultThreadImpl(); return new DefaultThreadImpl();
} }
@Override
public boolean isDebug(){
return false;
}
@Override @Override
public String getUUID(){ public String getUUID(){
try{ try{

View File

@@ -16,8 +16,6 @@ public class Mindustry extends ModuleCore{
Vars.init(); Vars.init();
debug = Platform.instance.isDebug();
Log.setUseColors(false); Log.setUseColors(false);
BundleLoader.load(); BundleLoader.load();
content.load(); content.load();

View File

@@ -89,20 +89,7 @@ public class Vars{
public static float fontScale; public static float fontScale;
//camera zoom displayed on startup //camera zoom displayed on startup
public static int baseCameraScale; 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; 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 showBlockDebug = false;
public static boolean showFog = true; public static boolean showFog = true;
public static boolean headless = false; public static boolean headless = false;

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.content;
import io.anuke.mindustry.content.blocks.*; import io.anuke.mindustry.content.blocks.*;
import io.anuke.mindustry.game.ContentList; import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Recipe; 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)); 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 //DEBUG
new Recipe(units, DebugBlocks.itemSource).setDebug(); new Recipe(units, DebugBlocks.itemSource).setMode(GameMode.sandbox).setHidden(true);
new Recipe(units, DebugBlocks.itemVoid).setDebug(); new Recipe(units, DebugBlocks.itemVoid).setMode(GameMode.sandbox).setHidden(true);
new Recipe(units, DebugBlocks.liquidSource).setDebug(); new Recipe(units, DebugBlocks.liquidSource).setMode(GameMode.sandbox).setHidden(true);
new Recipe(units, DebugBlocks.powerVoid).setDebug(); new Recipe(units, DebugBlocks.powerVoid).setMode(GameMode.sandbox).setHidden(true);
new Recipe(units, DebugBlocks.powerInfinite).setDebug(); new Recipe(units, DebugBlocks.powerInfinite).setMode(GameMode.sandbox).setHidden(true);
} }
@Override @Override

View File

@@ -273,7 +273,7 @@ public class Control extends Module{
for(int i = 0; i < content.recipes().size; i ++){ for(int i = 0; i < content.recipes().size; i ++){
Recipe recipe = content.recipes().get(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)){ if(control.database().unlockContent(recipe)){
ui.hudfrag.showUnlock(recipe); ui.hudfrag.showUnlock(recipe);
} }
@@ -351,7 +351,7 @@ public class Control extends Module{
throw new RuntimeException(error); 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; console = !console;
} }
@@ -391,8 +391,8 @@ public class Control extends Module{
if(!state.mode.infiniteResources && Timers.get("timerCheckUnlock", 120)){ if(!state.mode.infiniteResources && Timers.get("timerCheckUnlock", 120)){
checkUnlockableBlocks(); checkUnlockableBlocks();
//save if the db changed, but don't save in debug //save if the db changed
if(db.isDirty() && !debug){ if(db.isDirty()){
db.save(); db.save();
} }
} }

View File

@@ -10,9 +10,7 @@ import io.anuke.mindustry.game.EventType.ResetEvent;
import io.anuke.mindustry.game.EventType.WaveEvent; import io.anuke.mindustry.game.EventType.WaveEvent;
import io.anuke.mindustry.game.Teams; import io.anuke.mindustry.game.Teams;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.ItemType;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
@@ -49,14 +47,6 @@ public class Logic extends Module{
state.wavetime = wavespace * state.difficulty.timeScaling * 2; state.wavetime = wavespace * state.difficulty.timeScaling * 2;
for(Tile tile : state.teams.get(defaultTeam).cores){ 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){ if(world.getSector() != null){
Array<ItemStack> items = world.getSector().startingItems; Array<ItemStack> items = world.getSector().startingItems;
for(ItemStack stack : items){ for(ItemStack stack : items){

View File

@@ -23,6 +23,7 @@ import io.anuke.mindustry.net.*;
import io.anuke.mindustry.net.Administration.PlayerInfo; import io.anuke.mindustry.net.Administration.PlayerInfo;
import io.anuke.mindustry.net.Packets.*; import io.anuke.mindustry.net.Packets.*;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.Entities; import io.anuke.ucore.entities.Entities;
import io.anuke.ucore.entities.EntityGroup; import io.anuke.ucore.entities.EntityGroup;
@@ -125,7 +126,7 @@ public class NetServer extends Module{
return; return;
} }
boolean preventDuplicates = headless && !debug; boolean preventDuplicates = headless && isStrict();
if(preventDuplicates){ if(preventDuplicates){
for(Player player : playerGroup.all()){ 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){ public void sendWorldData(Player player, int clientID){
ByteArrayOutputStream stream = new ByteArrayOutputStream(); ByteArrayOutputStream stream = new ByteArrayOutputStream();
DeflaterOutputStream def = new DeflaterOutputStream(stream); DeflaterOutputStream def = new DeflaterOutputStream(stream);
@@ -302,7 +307,7 @@ public class NetServer extends Module{
NetConnection connection = player.con; NetConnection connection = player.con;
if(connection == null || snapshotID < connection.lastRecievedClientSnapshot) return; 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; if(connection.lastRecievedClientTime == 0) connection.lastRecievedClientTime = TimeUtils.millis() - 16;

View File

@@ -41,8 +41,6 @@ public abstract class Platform {
public String getLocaleName(Locale locale){ public String getLocaleName(Locale locale){
return locale.toString(); return locale.toString();
} }
/**Whether debug mode is enabled.*/
public boolean isDebug(){return false;}
/**Must be a base64 string 8 bytes in length.*/ /**Must be a base64 string 8 bytes in length.*/
public String getUUID(){ public String getUUID(){
String uuid = Settings.getString("uuid", ""); String uuid = Settings.getString("uuid", "");

View File

@@ -190,7 +190,7 @@ public class Renderer extends RendererModule{
camera.position.set(lastx - deltax, lasty - deltay, 0); 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 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()); EntityDraw.drawWith(shieldGroup, shield -> true, shield -> ((ShieldEntity)shield).drawOver());
Graphics.endShaders(); Graphics.endShaders();
if(showPaths && debug) drawDebug();
Graphics.flushSurface(); Graphics.flushSurface();
batch.end(); batch.end();

View File

@@ -123,8 +123,6 @@ public class UI extends SceneModule{
@Override @Override
public synchronized void update(){ public synchronized void update(){
if(Vars.debug && !Vars.showUI) return;
if(Graphics.drawing()) Graphics.end(); if(Graphics.drawing()) Graphics.end();
act(); act();

View File

@@ -568,15 +568,15 @@ public class MapEditorDialog extends Dialog implements Disposable{
for(Block block : Vars.content.blocks()){ for(Block block : Vars.content.blocks()){
TextureRegion[] regions = block.getCompactIcon(); TextureRegion[] regions = block.getCompactIcon();
if((block.synthetic() && (Recipe.getByResult(block) == null || !control.database().isUnlocked(Recipe.getByResult(block)))) if((block.synthetic() && (Recipe.getByResult(block) == null || !control.database().isUnlocked(Recipe.getByResult(block))))
&& !debug && block != StorageBlocks.core){ && block != StorageBlocks.core){
continue; continue;
} }
if(Recipe.getByResult(block) != null && Recipe.getByResult(block).debugOnly && !debug){ if(Recipe.getByResult(block) != null){
continue; continue;
} }
if(Recipe.getByResult(block) != null && Recipe.getByResult(block).desktopOnly && mobile && !debug){ if(Recipe.getByResult(block) != null && Recipe.getByResult(block).desktopOnly && mobile){
continue; continue;
} }

View File

@@ -266,7 +266,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
@Override @Override
public void draw(){ public void draw(){
if((debug && (!showPlayer || !showUI)) || dead) return; if(dead) return;
float x = snappedX(), y = snappedY(); float x = snappedX(), y = snappedY();
@@ -518,7 +518,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
isBoosting = true; 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 //fraction of speed when at max load
float carrySlowdown = 0.7f; float carrySlowdown = 0.7f;
@@ -570,7 +570,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
velocity.add(movement); velocity.add(movement);
} }
float prex = x, prey = y; float prex = x, prey = y;
updateVelocityStatus(mech.drag, debug ? 10f : mech.maxSpeed); updateVelocityStatus(mech.drag, mech.maxSpeed);
moved = distanceTo(prex, prey) > 0.01f; moved = distanceTo(prex, prey) > 0.01f;
}else{ }else{
velocity.setZero(); velocity.setZero();

View File

@@ -9,8 +9,6 @@ import io.anuke.mindustry.type.ContentType;
import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Settings; import io.anuke.ucore.core.Settings;
import static io.anuke.mindustry.Vars.debug;
public class ContentDatabase{ public class ContentDatabase{
/** Maps unlockable type names to a set of unlocked content.*/ /** Maps unlockable type names to a set of unlocked content.*/
private ObjectMap<ContentType, ObjectSet<String>> unlocked = new ObjectMap<>(); private ObjectMap<ContentType, ObjectSet<String>> unlocked = new ObjectMap<>();
@@ -23,7 +21,7 @@ public class ContentDatabase{
/** Returns whether or not this piece of content is unlocked yet.*/ /** Returns whether or not this piece of content is unlocked yet.*/
public boolean isUnlocked(UnlockableContent content){ public boolean isUnlocked(UnlockableContent content){
if(debug) return true; if(content.alwaysUnlocked()) return true;
if(!unlocked.containsKey(content.getContentType())){ if(!unlocked.containsKey(content.getContentType())){
unlocked.put(content.getContentType(), new ObjectSet<>()); unlocked.put(content.getContentType(), new ObjectSet<>());

View File

@@ -24,6 +24,11 @@ public abstract class UnlockableContent extends MappableContent{
return false; 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.*/ /**Lists the content that must be unlocked in order for this specific content to become unlocked. May return null.*/
public UnlockableContent[] getDependencies(){ public UnlockableContent[] getDependencies(){
return null; return null;

View File

@@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap; import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.OrderedMap; 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.game.UnlockableContent;
import io.anuke.mindustry.ui.ContentDisplay; import io.anuke.mindustry.ui.ContentDisplay;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -28,9 +28,11 @@ public class Recipe extends UnlockableContent{
public final Category category; public final Category category;
public final float cost; public final float cost;
public boolean desktopOnly = false, debugOnly = false; public boolean desktopOnly = false;
//the only gamemode in which the recipe shows up //the only gamemode in which the recipe shows up
public GameMode mode;
public boolean isPad; public boolean isPad;
public boolean hidden;
private UnlockableContent[] dependencies; private UnlockableContent[] dependencies;
private Block[] blockDependencies; private Block[] blockDependencies;
@@ -58,12 +60,12 @@ public class Recipe extends UnlockableContent{
*/ */
public static void getUnlockedByCategory(Category category, Array<Recipe> r){ public static void getUnlockedByCategory(Category category, Array<Recipe> r){
if(headless){ if(headless){
throw new RuntimeException("Not enabled on the headless backend!"); throw new RuntimeException("Not implemented on the headless backend!");
} }
r.clear(); r.clear();
for(Recipe recipe : content.recipes()){ 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); r.add(recipe);
} }
} }
@@ -95,14 +97,24 @@ public class Recipe extends UnlockableContent{
return this; return this;
} }
public Recipe setDebug(){ public Recipe setMode(GameMode mode){
debugOnly = true; this.mode = mode;
return this;
}
public Recipe setHidden(boolean hidden){
this.hidden = hidden;
return this; return this;
} }
@Override
public boolean alwaysUnlocked(){
return hidden;
}
@Override @Override
public boolean isHidden(){ public boolean isHidden(){
return debugOnly || (desktopOnly && mobile); return (desktopOnly && mobile) || hidden;
} }
@Override @Override

View File

@@ -54,10 +54,6 @@ public class SectorsDialog extends FloatingDialog{
ui.loadLogic(() -> world.sectors().playSector(selected)); ui.loadLogic(() -> world.sectors().playSector(selected));
}).size(230f, 64f).disabled(b -> selected == null) }).size(230f, 64f).disabled(b -> selected == null)
.update(t -> t.setText(selected != null && selected.hasSave() ? "$text.sector.resume" : "$text.sector.deploy")); .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){ void selectSector(Sector sector){

View File

@@ -171,7 +171,7 @@ public class BlocksFragment extends Fragment{
//add actual recipes //add actual recipes
for(Recipe r : 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"); ImageButton image = new ImageButton(new TextureRegion(), "select");

View File

@@ -1,45 +1,16 @@
package io.anuke.mindustry.ui.fragments; 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.Player;
import io.anuke.mindustry.entities.TileEntity; 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.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.core.Timers;
import io.anuke.ucore.entities.EntityGroup; import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.scene.Group; 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.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.*; import static io.anuke.mindustry.Vars.*;
public class DebugFragment extends Fragment{ 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(){ public static String debugInfo(){
int totalUnits = 0; int totalUnits = 0;
@@ -112,61 +83,6 @@ public class DebugFragment extends Fragment{
@Override @Override
public void build(Group parent){ 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.<UnitType>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 -> { parent.fill(t -> {
t.top().left().visible(() -> console); t.top().left().visible(() -> console);
@@ -174,28 +90,7 @@ public class DebugFragment extends Fragment{
p.defaults().fillX(); p.defaults().fillX();
p.pane("clear", new Label(DebugFragment::debugInfo)); 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);
});
} }
} }

View File

@@ -109,7 +109,7 @@ public class Build{
public static boolean validPlace(Team team, int x, int y, Block type, int rotation){ public static boolean validPlace(Team team, int x, int y, Block type, int rotation){
Recipe recipe = Recipe.getByResult(type); Recipe recipe = Recipe.getByResult(type);
if(recipe == null || (recipe.debugOnly && !debug)){ if(recipe == null || (recipe.mode != null && recipe.mode != state.mode)){
return false; return false;
} }

View File

@@ -213,7 +213,7 @@ public class BuildBlock extends Block{
builderID = builder.getID(); 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()); Call.onConstructFinish(tile, recipe.result, builderID, tile.getRotation(), builder.getTeam());
} }
} }
@@ -244,7 +244,7 @@ public class BuildBlock extends Block{
progress = Mathf.clamp(progress - amount); 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); Call.onDeconstructFinish(tile, this.recipe == null ? previous : this.recipe.result);
} }
} }

View File

@@ -97,11 +97,6 @@ public class CoreBlock extends StorageBlock{
topRegion = Draw.region(name + "-top"); topRegion = Draw.region(name + "-top");
} }
@Override
public float handleDamage(Tile tile, float amount){
return debug ? 0 : amount;
}
@Override @Override
public void draw(Tile tile){ public void draw(Tile tile){
CoreEntity entity = tile.entity(); CoreEntity entity = tile.entity();
@@ -200,11 +195,6 @@ public class CoreBlock extends StorageBlock{
entity.time += entity.delta(); entity.time += entity.delta();
entity.progress += 1f / (entity.currentUnit instanceof Player ? state.mode.respawnTime : droneRespawnDuration) * 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){ if(entity.progress >= 1f){
Call.onUnitRespawn(tile, entity.currentUnit); Call.onUnitRespawn(tile, entity.currentUnit);
} }

View File

@@ -15,11 +15,9 @@ import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.ui.dialogs.FileChooser; import io.anuke.mindustry.ui.dialogs.FileChooser;
import io.anuke.ucore.function.Consumer; import io.anuke.ucore.function.Consumer;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.OS; import io.anuke.ucore.util.OS;
import io.anuke.ucore.util.Strings; import io.anuke.ucore.util.Strings;
import java.io.File;
import java.net.NetworkInterface; import java.net.NetworkInterface;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
@@ -39,7 +37,7 @@ public class DesktopPlatform extends Platform{
public DesktopPlatform(String[] args){ public DesktopPlatform(String[] args){
this.args = args; this.args = args;
Vars.testMobile = isDebug() && Array.with(args).contains("-testMobile", false); Vars.testMobile = Array.with(args).contains("-testMobile", false);
if(useDiscord){ if(useDiscord){
DiscordEventHandlers handlers = new DiscordEventHandlers(); DiscordEventHandlers handlers = new DiscordEventHandlers();
@@ -117,14 +115,6 @@ public class DesktopPlatform extends Platform{
if(useDiscord) DiscordRPC.INSTANCE.Discord_Shutdown(); 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 @Override
public ThreadProvider getThreadProvider(){ public ThreadProvider getThreadProvider(){
return new DefaultThreadImpl(); return new DefaultThreadImpl();