Sync progress
This commit is contained in:
@@ -28,17 +28,17 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
static final float deathDelay = 30f;
|
||||
|
||||
@NonNull @ReadOnly Unitc unit = Nulls.unit;
|
||||
transient @Nullable NetConnection con;
|
||||
|
||||
@ReadOnly Team team = Team.sharded;
|
||||
String name = "noname";
|
||||
@Nullable NetConnection con;
|
||||
boolean admin, typing;
|
||||
boolean admin, typing, shooting;
|
||||
Color color = new Color();
|
||||
float mouseX, mouseY;
|
||||
float deathTimer;
|
||||
|
||||
String lastText = "";
|
||||
float textFadeTime;
|
||||
transient float deathTimer;
|
||||
transient String lastText = "";
|
||||
transient float textFadeTime;
|
||||
|
||||
public boolean isBuilder(){
|
||||
return unit instanceof Builderc;
|
||||
@@ -64,7 +64,16 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
|
||||
@Replace
|
||||
public float clipSize(){
|
||||
return 20;
|
||||
return unit.isNull() ? 20 : unit.type().hitsize * 2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSync(){
|
||||
unit.aim(mouseX, mouseY);
|
||||
//this is only necessary when the thing being controlled isn't synced
|
||||
unit.isShooting(shooting);
|
||||
//extra precaution, necessary for non-synced things
|
||||
unit.controller(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,6 +122,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
|
||||
public void unit(Unitc unit){
|
||||
if(unit == null) throw new IllegalArgumentException("Unit cannot be null. Use clearUnit() instead.");
|
||||
if(this.unit == unit) return;
|
||||
if(this.unit != Nulls.unit){
|
||||
//un-control the old unit
|
||||
this.unit.controller(this.unit.type().createController());
|
||||
|
||||
@@ -17,6 +17,7 @@ abstract class SyncComp implements Entityc{
|
||||
void writeSync(Writes write){}
|
||||
void readSyncManual(FloatBuffer buffer){}
|
||||
void writeSyncManual(FloatBuffer buffer){}
|
||||
void afterSync(){}
|
||||
void interpolate(){}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import mindustry.annotations.Annotations.*;
|
||||
|
||||
@Component
|
||||
abstract class TimerComp{
|
||||
Interval timer = new Interval(6);
|
||||
transient Interval timer = new Interval(6);
|
||||
|
||||
public boolean timer(int index, float time){
|
||||
return timer.get(index, time);
|
||||
|
||||
@@ -23,7 +23,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
|
||||
@Import float x, y, rotation, elevation, maxHealth;
|
||||
|
||||
private transient UnitController controller;
|
||||
private UnitController controller;
|
||||
private UnitType type;
|
||||
boolean spawnedByCore;
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
|
||||
/** weapon mount array, never null */
|
||||
@ReadOnly transient WeaponMount[] mounts = {};
|
||||
@ReadOnly transient float range, aimX, aimY;
|
||||
@ReadOnly transient boolean isRotate, isShooting;
|
||||
@ReadOnly transient boolean isRotate;
|
||||
boolean isShooting;
|
||||
|
||||
void setWeaponRotation(float rotation){
|
||||
for(WeaponMount mount : mounts){
|
||||
|
||||
Reference in New Issue
Block a user