Improved snapshot netcode
This commit is contained in:
@@ -864,7 +864,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput buffer, long time) throws IOException{
|
||||
public void read(DataInput buffer) throws IOException{
|
||||
float lastx = x, lasty = y, lastrot = rotation;
|
||||
super.readSave(buffer);
|
||||
name = TypeIO.readStringData(buffer);
|
||||
@@ -880,7 +880,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
readBuilding(buffer, !isLocal);
|
||||
|
||||
interpolator.read(lastx, lasty, x, y, time, rotation, baseRotation);
|
||||
interpolator.read(lastx, lasty, x, y, rotation, baseRotation);
|
||||
rotation = lastrot;
|
||||
|
||||
if(isLocal){
|
||||
|
||||
@@ -158,7 +158,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{
|
||||
public void read(DataInput data) throws IOException{
|
||||
x = data.readFloat();
|
||||
y = data.readFloat();
|
||||
velocity.x = data.readFloat();
|
||||
|
||||
@@ -177,7 +177,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{
|
||||
public void read(DataInput data) throws IOException{
|
||||
x = data.readFloat();
|
||||
y = data.readFloat();
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class Lightning extends TimedEntity implements DrawTrait, SyncTrait, Time
|
||||
public void write(DataOutput data){}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time){}
|
||||
public void read(DataInput data){}
|
||||
|
||||
@Override
|
||||
public float lifetime(){
|
||||
|
||||
@@ -301,7 +301,7 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{
|
||||
public void read(DataInput data) throws IOException{
|
||||
x = data.readFloat();
|
||||
y = data.readFloat();
|
||||
liquid = content.liquid(data.readByte());
|
||||
|
||||
@@ -66,5 +66,5 @@ public interface SyncTrait extends Entity, TypeTrait{
|
||||
//Read and write sync data, usually position
|
||||
void write(DataOutput data) throws IOException;
|
||||
|
||||
void read(DataInput data, long time) throws IOException;
|
||||
void read(DataInput data) throws IOException;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import io.anuke.arc.math.geom.Geometry;
|
||||
import io.anuke.arc.math.geom.Rectangle;
|
||||
import io.anuke.arc.util.Interval;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.arc.util.Timer;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.fx.ExplosionFx;
|
||||
import io.anuke.mindustry.entities.Damage;
|
||||
@@ -398,12 +397,12 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{
|
||||
public void read(DataInput data) throws IOException{
|
||||
float lastx = x, lasty = y, lastrot = rotation;
|
||||
super.readSave(data);
|
||||
this.type = content.getByID(ContentType.unit, data.readByte());
|
||||
|
||||
interpolator.read(lastx, lasty, x, y, time, rotation);
|
||||
interpolator.read(lastx, lasty, x, y, rotation);
|
||||
rotation = lastrot;
|
||||
}
|
||||
|
||||
|
||||
@@ -219,8 +219,8 @@ public abstract class GroundUnit extends BaseUnit{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{
|
||||
super.read(data, time);
|
||||
public void read(DataInput data) throws IOException{
|
||||
super.read(data);
|
||||
weapon = content.getByID(ContentType.weapon, data.readByte());
|
||||
}
|
||||
|
||||
|
||||
@@ -99,8 +99,8 @@ public class AlphaDrone extends FlyingUnit {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput stream, long time) throws IOException {
|
||||
super.read(stream, time);
|
||||
public void read(DataInput stream) throws IOException {
|
||||
super.read(stream);
|
||||
leader = Vars.playerGroup.getByID(stream.readInt());
|
||||
}
|
||||
|
||||
|
||||
@@ -362,8 +362,8 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{
|
||||
super.read(data, time);
|
||||
public void read(DataInput data) throws IOException{
|
||||
super.read(data);
|
||||
int mined = data.readInt();
|
||||
int repairing = data.readInt();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user