Give craters surfboards to stream

This commit is contained in:
Patrick 'Quezler' Mounier 2020-01-03 17:18:48 +01:00
parent 0b0007502f
commit 1f6d3dca0e
No known key found for this signature in database
GPG Key ID: 0D6CA7326C76D8EA

View File

@ -15,6 +15,8 @@ import arc.scene.ui.layout.*;
import mindustry.world.meta.*;
import mindustry.entities.type.*;
import java.io.*;
import static mindustry.Vars.*;
public class CraterConveyor extends BaseConveyor{
@ -154,6 +156,21 @@ public class CraterConveyor extends BaseConveyor{
float lastFrameSpawned = -1;
float lastFrameChanged = -1;
Crater crater;
@Override
public void write(DataOutput stream) throws IOException{
super.write(stream);
stream.writeBoolean(crater != null);
if(crater != null) crater.write(stream);
}
@Override
public void read(DataInput stream, byte revision) throws IOException{
super.read(stream, revision);
if(stream.readBoolean()) crater = new Crater(stream);
}
}
protected class Crater implements Position{
@ -170,6 +187,20 @@ public class CraterConveyor extends BaseConveyor{
face = rotation;
}
Crater(DataInput stream) throws IOException{
rotation = stream.readFloat();
face = stream.readFloat();
x = stream.readFloat();
y = stream.readFloat();
}
public void write(DataOutput stream) throws IOException{
stream.writeFloat(rotation);
stream.writeFloat(face);
stream.writeFloat(x);
stream.writeFloat(y);
}
@Override
public float getX(){
return x;