Fixed dashing not syncing, position being verified on client hosting

This commit is contained in:
Anuken
2018-06-25 18:33:40 -04:00
parent 5a135e108a
commit d948607039
3 changed files with 6 additions and 8 deletions

View File

@@ -164,7 +164,7 @@ public class NetServer extends Module{
NetConnection connection = Net.getConnection(id); NetConnection connection = Net.getConnection(id);
if(player == null || connection == null || packet.snapid < connection.lastRecievedSnapshot) return; if(player == null || connection == null || packet.snapid < connection.lastRecievedSnapshot) return;
boolean verifyPosition = !player.isDead() && !debug && !headless; boolean verifyPosition = !player.isDead() && !debug && headless;
if(connection.lastRecievedTime == 0) connection.lastRecievedTime = TimeUtils.millis() - 16; if(connection.lastRecievedTime == 0) connection.lastRecievedTime = TimeUtils.millis() - 16;

View File

@@ -271,7 +271,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f); baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f);
} }
boostHeat = Mathf.lerpDelta(boostHeat, isBoosting && !movement.isZero() && moved ? 1f : 0f, 0.08f); boostHeat = Mathf.lerpDelta(boostHeat, isBoosting && ((!movement.isZero() && moved) || !isLocal) ? 1f : 0f, 0.08f);
boolean snap = snapCamera && isLocal; boolean snap = snapCamera && isLocal;
@@ -717,7 +717,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
color.set(buffer.readInt()); color.set(buffer.readInt());
dead = buffer.readBoolean(); dead = buffer.readBoolean();
mech = Upgrade.getByID(buffer.readByte()); mech = Upgrade.getByID(buffer.readByte());
boolean dashing = buffer.readBoolean(); boolean boosting = buffer.readBoolean();
int mine = buffer.readInt(); int mine = buffer.readInt();
interpolator.read(lastx, lasty, x, y, time, rotation); interpolator.read(lastx, lasty, x, y, time, rotation);
rotation = lastrot; rotation = lastrot;
@@ -727,7 +727,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
y = lasty; y = lasty;
}else{ }else{
mining = world.tile(mine); mining = world.tile(mine);
isBoosting = dashing; isBoosting = boosting;
} }
} }

View File

@@ -24,9 +24,7 @@ import io.anuke.ucore.entities.Entities;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import static io.anuke.mindustry.Vars.bulletGroup; import static io.anuke.mindustry.Vars.*;
import static io.anuke.mindustry.Vars.playerGroup;
import static io.anuke.mindustry.Vars.world;
/**Class for specifying read/write methods for code generation.*/ /**Class for specifying read/write methods for code generation.*/
public class TypeIO { public class TypeIO {
@@ -67,7 +65,7 @@ public class TypeIO {
@ReadClass(Bullet.class) @ReadClass(Bullet.class)
public static Bullet readBullet(ByteBuffer buffer){ public static Bullet readBullet(ByteBuffer buffer){
int id = buffer.getInt(); int id = buffer.getInt();
return (Bullet)bulletGroup.getByID(id); return bulletGroup.getByID(id);
} }
@WriteClass(CarriableTrait.class) @WriteClass(CarriableTrait.class)