From db2f61ec29a7f6581bffaac8d952ca43a144cc91 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 23 Jun 2020 21:07:20 -0400 Subject: [PATCH] less instant disconnect, more broken multiplayer --- core/src/mindustry/core/NetServer.java | 5 ++++- core/src/mindustry/entities/comp/UnitComp.java | 4 ++-- core/src/mindustry/entities/units/AIController.java | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index 5eb1d6f9c0..d05e819207 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -633,7 +633,10 @@ public class NetServer implements ApplicationListener{ } //reset player to previous synced position so it gets interpolated - unit.set(prevx, prevy); + //the server does not interpolate + if(!headless){ + unit.set(prevx, prevy); + } //write sync data to the buffer fbuffer.limit(20); diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 56da4ca4cc..70a83827ce 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -127,12 +127,12 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I public void afterSync(){ //set up type info after reading setStats(this.type); + controller.unit(this); } @Override public void afterRead(){ - //set up type info after reading - setStats(this.type); + afterSync(); } @Override diff --git a/core/src/mindustry/entities/units/AIController.java b/core/src/mindustry/entities/units/AIController.java index 02f07206f0..63a852ba0c 100644 --- a/core/src/mindustry/entities/units/AIController.java +++ b/core/src/mindustry/entities/units/AIController.java @@ -49,6 +49,8 @@ public class AIController implements UnitController{ @Override public void unit(Unitc unit){ + if(this.unit == unit) return; + this.unit = unit; init(); }