Better net error messages, bugfixes, new command handler
This commit is contained in:
@@ -329,12 +329,6 @@ public class NetClient extends Module {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO remove.
|
||||
public void test(){
|
||||
gotData = false;
|
||||
connecting = true;
|
||||
}
|
||||
|
||||
public boolean hasData(){
|
||||
return gotData;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
@@ -82,6 +83,12 @@ public class EnemyType {
|
||||
|
||||
Graphics.flush();
|
||||
|
||||
if(isCalculating(enemy)){
|
||||
Draw.color(Color.SKY);
|
||||
Lines.polySeg(20, 0, 5, enemy.x, enemy.y, 11f, Timers.time() * 2f + enemy.id*52153f);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
if(showPaths){
|
||||
Draw.tscl(0.25f);
|
||||
Draw.text((int)enemy.idletime + " " + enemy.node + " " + enemy.id + "\n" + Strings.toFixed(enemy.totalMove.x, 2) + ", "
|
||||
@@ -157,6 +164,8 @@ public class EnemyType {
|
||||
|
||||
Tile core = world.getCore();
|
||||
|
||||
if(core == null) return;
|
||||
|
||||
if(enemy.idletime > maxIdleLife && enemy.node > 0){
|
||||
enemy.onDeath();
|
||||
return;
|
||||
@@ -190,7 +199,7 @@ public class EnemyType {
|
||||
}else if(dst < avoidRange){
|
||||
calc.set((enemy.x - other.x), (enemy.y - other.y)).setLength(avoidSpeed);
|
||||
shift.add(calc.scl(1.1f));
|
||||
}else if(dst < attractRange && !nearCore){
|
||||
}else if(dst < attractRange && !nearCore && !isCalculating(enemy)){
|
||||
calc.set((enemy.x - other.x), (enemy.y - other.y)).setLength(avoidSpeed);
|
||||
shift.add(calc.scl(-1));
|
||||
}
|
||||
@@ -268,6 +277,10 @@ public class EnemyType {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCalculating(Enemy enemy){
|
||||
return enemy.node < 0 && !Net.client();
|
||||
}
|
||||
|
||||
public static EnemyType getByID(byte id){
|
||||
return types.get(id);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public class Net{
|
||||
}
|
||||
|
||||
/**Pings a host in an new thread. If an error occured, failed() should be called with the exception. */
|
||||
public static void pingHost(String address, int port, Consumer<Host> valid, Consumer<IOException> failed){
|
||||
public static void pingHost(String address, int port, Consumer<Host> valid, Consumer<Exception> failed){
|
||||
clientProvider.pingHost(address, port, valid, failed);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public class Net{
|
||||
* Callback should be run on libGDX main thread.*/
|
||||
void discover(Consumer<Array<Host>> callback);
|
||||
/**Ping a host. If an error occured, failed() should be called with the exception. */
|
||||
void pingHost(String address, int port, Consumer<Host> valid, Consumer<IOException> failed);
|
||||
void pingHost(String address, int port, Consumer<Host> valid, Consumer<Exception> failed);
|
||||
/**Close all connections.*/
|
||||
void dispose();
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class MenuFragment implements Fragment{
|
||||
|
||||
public void build(){
|
||||
if(!android){
|
||||
//menu table
|
||||
new table(){{
|
||||
|
||||
new table(){{
|
||||
visible(() -> state.is(State.menu));
|
||||
|
||||
if(!android){
|
||||
new table(){{
|
||||
PressGroup group = new PressGroup();
|
||||
|
||||
@@ -53,37 +53,32 @@ public class MenuFragment implements Fragment{
|
||||
}
|
||||
get().margin(16);
|
||||
}}.end();
|
||||
|
||||
visible(() -> state.is(State.menu));
|
||||
}}.end();
|
||||
}else{
|
||||
new table(){{
|
||||
new table(){{
|
||||
|
||||
}else {
|
||||
new table() {{
|
||||
defaults().size(120f).pad(5);
|
||||
float isize = 14f*4;
|
||||
|
||||
float isize = 14f * 4;
|
||||
|
||||
new imagebutton("icon-play-2", isize, ui.levels::show).text("$text.play").padTop(4f);
|
||||
|
||||
|
||||
new imagebutton("icon-tutorial", isize, () -> control.playMap(world.maps().getMap("tutorial"))).text("$text.tutorial").padTop(4f);
|
||||
|
||||
|
||||
new imagebutton("icon-load", isize, ui.load::show).text("$text.load").padTop(4f);
|
||||
|
||||
new imagebutton("icon-add", isize, ui.join::show).text("$text.joingame").padTop(4f);
|
||||
|
||||
|
||||
row();
|
||||
|
||||
new imagebutton("icon-editor", isize, ui.editor::show).text("$text.editor").padTop(4f);
|
||||
|
||||
|
||||
new imagebutton("icon-tools", isize, ui.settings::show).text("$text.settings").padTop(4f);
|
||||
|
||||
new imagebutton("icon-info", isize, ui.about::show).text("$text.about.button").padTop(4f);
|
||||
|
||||
new imagebutton("icon-donate", isize, Platform.instance::openDonations).text("$text.donate").padTop(4f);
|
||||
|
||||
visible(() -> state.is(State.menu));
|
||||
}}.end();
|
||||
}}.end();
|
||||
}
|
||||
}
|
||||
}}.end();
|
||||
|
||||
//extra icons in top right
|
||||
new table(){{
|
||||
|
||||
Reference in New Issue
Block a user