Fixed jittery snapshots / Fixed misaligned unit bullets

This commit is contained in:
Anuken
2018-08-26 17:38:22 -04:00
parent 864c4f6bc3
commit 06ad35d934
13 changed files with 132 additions and 70 deletions

View File

@@ -460,6 +460,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
altHeat = Mathf.lerpDelta(altHeat, isAlt ? 1f : 0f, mech.altChargeAlpha);
boostHeat = Mathf.lerpDelta(boostHeat, (tile != null && tile.solid()) || (isBoosting && ((!movement.isZero() && moved) || !isLocal)) ? 1f : 0f, 0.08f);
mech.updateAlt(this); //updated regardless
if(!isLocal){
interpolate();
@@ -480,8 +481,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
control.database().unlockContent(mech);
}
mech.updateAlt(this);
if(mobile){
updateFlying();
}else{

View File

@@ -23,7 +23,7 @@ public class AlphaDrone extends FlyingUnit {
public final UnitState attack = new UnitState() {
@Override
public void update() {
if(leader == null || leader.isDead()){
if(leader == null || leader.isDead() || !leader.isAdded()){
damage(99999f);
return;
}
@@ -67,12 +67,19 @@ public class AlphaDrone extends FlyingUnit {
}
@Override
public void writeSave(DataOutput stream) throws IOException {
super.writeSave(stream);
public void write(DataOutput stream) throws IOException {
super.write(stream);
stream.writeInt(leader == null ? -1 : leader.id);
}
@Override
public void readSave(DataInput stream) throws IOException {
public void read(DataInput stream, long time) throws IOException {
super.read(stream, time);
leader = Vars.playerGroup.getByID(stream.readInt());
}
@Override
public void readSave(DataInput stream) throws IOException{
super.readSave(stream);
if(!Net.active()){