Removed debug mode / Added source blocks to sandbox
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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.<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 -> {
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user