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