Switched to different Kryonet fork; full Android support

This commit is contained in:
Anuken
2018-01-01 16:09:17 -05:00
parent c7dbdd1773
commit 20eea3b385
27 changed files with 416 additions and 310 deletions
+2
View File
@@ -192,6 +192,8 @@ public class Net{
public IntArray getConnections();
/**Register classes to be sent.*/
public void register(Class<?>... types);
/**Returns the ping for a certain connection.*/
public int getPingFor(int connection);
}
public enum SendMode{
+13 -3
View File
@@ -28,17 +28,27 @@ public class Packets {
public static class SyncPacket{
public int[] ids;
public float[][] data;
public int enemyStart = 0;
public short enemyStart;
}
public static class BlockSyncPacket extends Streamable{
}
public static class StateSyncPacket {
public static class ConnectPacket{
public String name;
public boolean android;
}
public static class DisconnectPacket{
public int playerid;
}
public static class StateSyncPacket{
public int[] items;
public float countdown;
public float countdown, time;
public int enemies, wave;
public long timestamp;
}
public static class PositionPacket{
@@ -31,6 +31,8 @@ public class Registrator {
EnemyDeathPacket.class,
BlockUpdatePacket.class,
BlockDestroyPacket.class,
ConnectPacket.class,
DisconnectPacket.class,
Class.class,
byte[].class,
@@ -1,7 +1,6 @@
package io.anuke.mindustry.net;
import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.enemies.Enemy;
import io.anuke.mindustry.graphics.Fx;
@@ -37,11 +36,11 @@ public interface Syncable {
@Override
public void update(Player entity, Interpolator interpolator) {
Interpolator i = entity.getInterpolator();
if(i.target.dst(entity.x, entity.y) > 16){
if(i.target.dst(entity.x, entity.y) > 16 && !entity.isAndroid){
entity.set(i.target.x, i.target.y);
}
if(Vars.android && i.target.dst(entity.x, entity.y) > 2f && Timers.get(entity, "dashfx", 3)){
if(entity.isAndroid && i.target.dst(entity.x, entity.y) > 2f && Timers.get(entity, "dashfx", 2)){
Angles.translation(entity.angle + 180, 3f);
Effects.effect(Fx.dashsmoke, entity.x + Angles.x(), entity.y + Angles.y());
}