Better net error messages, bugfixes, new command handler

This commit is contained in:
Anuken
2018-02-23 21:42:05 -05:00
parent de340255fe
commit 9985a19e6a
9 changed files with 89 additions and 84 deletions

View File

@@ -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);
}