Removed delta compression / Removed client snapshot packet
This commit is contained in:
@@ -25,13 +25,13 @@ public class UnitInventory implements Saveable{
|
||||
|
||||
@Override
|
||||
public void writeSave(DataOutput stream) throws IOException{
|
||||
stream.writeShort(item.amount);
|
||||
stream.writeByte(item.amount);
|
||||
stream.writeByte(item.item.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSave(DataInput stream) throws IOException{
|
||||
short iamount = stream.readShort();
|
||||
int iamount = stream.readUnsignedByte();
|
||||
byte iid = stream.readByte();
|
||||
|
||||
item.item = content.item(iid);
|
||||
|
||||
@@ -12,16 +12,12 @@ import static io.anuke.mindustry.Vars.threads;
|
||||
|
||||
public interface SyncTrait extends Entity, TypeTrait{
|
||||
|
||||
/**
|
||||
* Whether smoothing of entities is enabled when using multithreading; not yet implemented.
|
||||
*/
|
||||
/**Whether smoothing of entities is enabled when using multithreading; not yet implemented.*/
|
||||
static boolean isSmoothing(){
|
||||
return threads.isEnabled() && threads.getTPS() <= Gdx.graphics.getFramesPerSecond() / 2f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position of this entity and updated the interpolator.
|
||||
*/
|
||||
/**Sets the position of this entity and updated the interpolator.*/
|
||||
default void setNet(float x, float y){
|
||||
set(x, y);
|
||||
|
||||
@@ -34,9 +30,7 @@ public interface SyncTrait extends Entity, TypeTrait{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interpolate entity position only. Override if you need to interpolate rotations or other values.
|
||||
*/
|
||||
/**Interpolate entity position only. Override if you need to interpolate rotations or other values.*/
|
||||
default void interpolate(){
|
||||
if(getInterpolator() == null)
|
||||
throw new RuntimeException("This entity must have an interpolator to interpolate()!");
|
||||
@@ -47,20 +41,21 @@ public interface SyncTrait extends Entity, TypeTrait{
|
||||
setY(getInterpolator().pos.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the interpolator used for smoothing the position. Optional.
|
||||
*/
|
||||
/**Return the interpolator used for smoothing the position. Optional.*/
|
||||
default Interpolator getInterpolator(){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether syncing is enabled for this entity; true by default.
|
||||
*/
|
||||
/**Whether syncing is enabled for this entity; true by default.*/
|
||||
default boolean isSyncing(){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**Whether this entity is clipped and not synced when out of viewport.*/
|
||||
default boolean isClipped(){
|
||||
return true;
|
||||
}
|
||||
|
||||
//Read and write sync data, usually position
|
||||
void write(DataOutput data) throws IOException;
|
||||
|
||||
|
||||
@@ -394,7 +394,6 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
public void write(DataOutput data) throws IOException{
|
||||
super.writeSave(data);
|
||||
data.writeByte(type.id);
|
||||
data.writeInt(spawner);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -402,7 +401,6 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
float lastx = x, lasty = y, lastrot = rotation;
|
||||
super.readSave(data);
|
||||
this.type = content.getByID(ContentType.unit, data.readByte());
|
||||
this.spawner = data.readInt();
|
||||
|
||||
interpolator.read(lastx, lasty, x, y, time, rotation);
|
||||
rotation = lastrot;
|
||||
|
||||
Reference in New Issue
Block a user