Sync unit velocity / Sync separator seed / 127.x Compat break
This commit is contained in:
@@ -120,7 +120,7 @@ public class UnitTypes implements ContentList{
|
||||
hitSize = 13f;
|
||||
rotateSpeed = 3f;
|
||||
targetAir = false;
|
||||
health = 820;
|
||||
health = 900;
|
||||
armor = 9f;
|
||||
mechFrontSway = 0.55f;
|
||||
|
||||
@@ -133,15 +133,15 @@ public class UnitTypes implements ContentList{
|
||||
shake = 2f;
|
||||
ejectEffect = Fx.casing2;
|
||||
shootSound = Sounds.artillery;
|
||||
bullet = new ArtilleryBulletType(2f, 8, "shell"){{
|
||||
bullet = new ArtilleryBulletType(2f, 20, "shell"){{
|
||||
hitEffect = Fx.blastExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 120f;
|
||||
width = height = 14f;
|
||||
collides = true;
|
||||
collidesTiles = true;
|
||||
splashDamageRadius = 30f;
|
||||
splashDamage = 60f;
|
||||
splashDamageRadius = 35f;
|
||||
splashDamage = 80f;
|
||||
backColor = Pal.bulletYellowBack;
|
||||
frontColor = Pal.bulletYellow;
|
||||
}};
|
||||
|
||||
@@ -44,6 +44,13 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
}
|
||||
}
|
||||
|
||||
//bullets always considered local
|
||||
@Override
|
||||
@Replace
|
||||
public boolean isLocal(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(){
|
||||
type.init(self());
|
||||
|
||||
@@ -16,8 +16,8 @@ abstract class ShieldComp implements Healthc, Posc{
|
||||
|
||||
/** Absorbs health damage. */
|
||||
float shield;
|
||||
/** Subtracts an amount from damage. */
|
||||
float armor;
|
||||
/** Subtracts an amount from damage. No need to save. */
|
||||
transient float armor;
|
||||
/** Shield opacity. */
|
||||
transient float shieldAlpha = 0f;
|
||||
|
||||
|
||||
@@ -13,20 +13,24 @@ import static mindustry.Vars.*;
|
||||
abstract class VelComp implements Posc{
|
||||
@Import float x, y;
|
||||
|
||||
//TODO @SyncLocal this? does it even need to be sent?
|
||||
transient final Vec2 vel = new Vec2();
|
||||
@SyncLocal Vec2 vel = new Vec2();
|
||||
|
||||
transient float drag = 0f;
|
||||
|
||||
//velocity needs to be called first, as it affects delta and lastPosition
|
||||
@MethodPriority(-1)
|
||||
@Override
|
||||
public void update(){
|
||||
float px = x, py = y;
|
||||
move(vel.x * Time.delta, vel.y * Time.delta);
|
||||
if(Mathf.equal(px, x)) vel.x = 0;
|
||||
if(Mathf.equal(py, y)) vel.y = 0;
|
||||
//do not update velocity on the client at all, unless it's non-interpolated
|
||||
//velocity conflicts with interpolation.
|
||||
if(!net.client() || isLocal()){
|
||||
float px = x, py = y;
|
||||
move(vel.x * Time.delta, vel.y * Time.delta);
|
||||
if(Mathf.equal(px, x)) vel.x = 0;
|
||||
if(Mathf.equal(py, y)) vel.y = 0;
|
||||
|
||||
vel.scl(Math.max(1f - drag * Time.delta, 0));
|
||||
vel.scl(Math.max(1f - drag * Time.delta, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/** @return function to use for check solid state. if null, no checking is done. */
|
||||
|
||||
@@ -128,19 +128,17 @@ public class Separator extends Block{
|
||||
return !consumes.itemFilters.get(item.id);
|
||||
}
|
||||
|
||||
//TODO write seed in 128 release, don't write it now for compatibility with 127.x
|
||||
//@Override
|
||||
//public byte version(){
|
||||
// return 1;
|
||||
//}
|
||||
@Override
|
||||
public byte version(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
write.f(progress);
|
||||
write.f(warmup);
|
||||
//TODO see above
|
||||
//write.i(seed);
|
||||
write.i(seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,8 +146,7 @@ public class Separator extends Block{
|
||||
super.read(read, revision);
|
||||
progress = read.f();
|
||||
warmup = read.f();
|
||||
//TODO see above
|
||||
//if(revision == 1) seed = read.i();
|
||||
if(revision == 1) seed = read.i();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user