Fixed ghost enemies and jerky movement at low FPS values
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Sun Feb 11 16:16:21 EST 2018
|
#Sun Feb 11 17:04:14 EST 2018
|
||||||
version=beta
|
version=beta
|
||||||
androidBuildCode=168
|
androidBuildCode=172
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.3
|
code=3.3
|
||||||
build=custom build
|
build=custom build
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.core;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.utils.IntMap;
|
||||||
import com.badlogic.gdx.utils.IntSet;
|
import com.badlogic.gdx.utils.IntSet;
|
||||||
import com.badlogic.gdx.utils.TimeUtils;
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
@@ -43,12 +44,15 @@ public class NetClient extends Module {
|
|||||||
private boolean gotData = false;
|
private boolean gotData = false;
|
||||||
private boolean kicked = false;
|
private boolean kicked = false;
|
||||||
private IntSet recieved = new IntSet();
|
private IntSet recieved = new IntSet();
|
||||||
|
private IntMap<Entity> recent = new IntMap<>();
|
||||||
|
|
||||||
public NetClient(){
|
public NetClient(){
|
||||||
|
|
||||||
Net.handleClient(Connect.class, packet -> {
|
Net.handleClient(Connect.class, packet -> {
|
||||||
|
|
||||||
Net.setClientLoaded(false);
|
Net.setClientLoaded(false);
|
||||||
recieved.clear();
|
recieved.clear();
|
||||||
|
recent.clear();
|
||||||
connecting = true;
|
connecting = true;
|
||||||
gotData = false;
|
gotData = false;
|
||||||
kicked = false;
|
kicked = false;
|
||||||
@@ -169,6 +173,7 @@ public class NetClient extends Module {
|
|||||||
recieved.contains(packet.entity.id)) return;
|
recieved.contains(packet.entity.id)) return;
|
||||||
|
|
||||||
recieved.add(packet.entity.id);
|
recieved.add(packet.entity.id);
|
||||||
|
recent.put(packet.entity.id, packet.entity);
|
||||||
|
|
||||||
packet.entity.add();
|
packet.entity.add();
|
||||||
|
|
||||||
@@ -179,6 +184,8 @@ public class NetClient extends Module {
|
|||||||
Enemy enemy = enemyGroup.getByID(packet.id);
|
Enemy enemy = enemyGroup.getByID(packet.id);
|
||||||
if (enemy != null){
|
if (enemy != null){
|
||||||
enemy.type.onDeath(enemy, true);
|
enemy.type.onDeath(enemy, true);
|
||||||
|
}else if(recent.get(packet.id) != null){
|
||||||
|
recent.get(packet.id).remove();
|
||||||
}else{
|
}else{
|
||||||
Log.err("Got remove for null entity! {0}", packet.id);
|
Log.err("Got remove for null entity! {0}", packet.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,8 +294,8 @@ public class Player extends SyncEntity{
|
|||||||
|
|
||||||
Interpolator i = interpolator;
|
Interpolator i = interpolator;
|
||||||
|
|
||||||
float tx = x + Angles.trnsx(angle + 180f, 3f);
|
float tx = x + Angles.trnsx(angle + 180f, 4f);
|
||||||
float ty = y + Angles.trnsy(angle + 180f, 3f);
|
float ty = y + Angles.trnsy(angle + 180f, 4f);
|
||||||
|
|
||||||
if(isAndroid && i.target.dst(i.last) > 2f && timer.get(timerDash, 1)){
|
if(isAndroid && i.target.dst(i.last) > 2f && timer.get(timerDash, 1)){
|
||||||
Effects.effect(Fx.dashsmoke, tx, ty);
|
Effects.effect(Fx.dashsmoke, tx, ty);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public abstract class SyncEntity extends DestructibleEntity{
|
|||||||
|
|
||||||
public void update(){
|
public void update(){
|
||||||
|
|
||||||
time += 1f / spacing * Timers.delta();
|
time += 1f / spacing * Math.min(Timers.delta(), 1f);
|
||||||
|
|
||||||
Mathf.lerp2(pos.set(last), target, time);
|
Mathf.lerp2(pos.set(last), target, time);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user