Improvements to playability at low TPS
This commit is contained in:
@@ -41,8 +41,6 @@ import java.io.IOException;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Player extends Unit implements BuilderTrait, CarryTrait {
|
||||
private static final Vector2 movement = new Vector2();
|
||||
|
||||
public static int typeID = -1;
|
||||
|
||||
public static final int timerShootLeft = 0;
|
||||
@@ -73,6 +71,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
||||
private Tile mining;
|
||||
private CarriableTrait carrying;
|
||||
private Trail trail = new Trail(16);
|
||||
private Vector2 movement = new Vector2();
|
||||
private boolean moved;
|
||||
|
||||
public Player(){
|
||||
hitbox.setSize(5);
|
||||
@@ -242,13 +242,18 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
||||
|
||||
@Override
|
||||
public float drawSize() {
|
||||
return 40;
|
||||
return isLocal ? Float.MAX_VALUE : 40;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
if((debug && (!showPlayer || !showUI)) || dead) return;
|
||||
|
||||
if(!movement.isZero() && moved){
|
||||
walktime += Timers.delta() * movement.len()/1.6f * getFloorOn().speedMultiplier;
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f);
|
||||
}
|
||||
|
||||
boolean snap = snapCamera && isLocal;
|
||||
|
||||
float px = x, py =y;
|
||||
@@ -491,12 +496,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
||||
|
||||
velocity.add(movement);
|
||||
|
||||
float prex = x, prey = y;
|
||||
updateVelocityStatus(mech.drag, debug ? speed : mech.maxSpeed);
|
||||
|
||||
if(!movement.isZero()){
|
||||
walktime += Timers.delta() * velocity.len()*(1f/0.5f)/speed * getFloorOn().speedMultiplier;
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f);
|
||||
}
|
||||
moved = distanceTo(prex, prey) > 0.01f;
|
||||
|
||||
if(!isShooting()){
|
||||
if(!movement.isZero()) {
|
||||
|
||||
@@ -51,6 +51,16 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
protected float hitTime;
|
||||
protected float drownTime;
|
||||
|
||||
@Override
|
||||
public float getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation) {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarrier(CarryTrait carrier) {
|
||||
this.carrier = carrier;
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.entities.bullet;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Pools;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
@@ -10,6 +11,7 @@ import io.anuke.mindustry.entities.traits.TeamTrait;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.net.In;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.impl.BulletEntity;
|
||||
import io.anuke.ucore.entities.trait.Entity;
|
||||
@@ -59,7 +61,15 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
|
||||
bullet.team = team;
|
||||
bullet.type = type;
|
||||
bullet.set(x, y);
|
||||
|
||||
//translate bullets backwards, purely for visual reasons
|
||||
float backDelta = Timers.delta();
|
||||
|
||||
bullet.lastPosition().set(x-bullet.velocity.x * backDelta, y-bullet.velocity.y * backDelta, bullet.angle());
|
||||
bullet.setLastUpdated(TimeUtils.millis());
|
||||
bullet.setUpdateSpacing((long)((Timers.delta() / 60f) * 1000));
|
||||
bullet.set(x-bullet.velocity.x * backDelta, y-bullet.velocity.y * backDelta);
|
||||
|
||||
bullet.add();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package io.anuke.mindustry.entities.units;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.content.fx.ExplosionFx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
@@ -20,7 +18,10 @@ import io.anuke.mindustry.world.meta.BlockFlag;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.util.*;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Geometry;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Timer;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -30,7 +31,6 @@ import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public abstract class BaseUnit extends Unit{
|
||||
private static int timerIndex = 0;
|
||||
private static Vector2 moveVector = new Translator();
|
||||
|
||||
protected static final int timerTarget = timerIndex++;
|
||||
protected static final int timerReload = timerIndex++;
|
||||
@@ -113,7 +113,7 @@ public abstract class BaseUnit extends Unit{
|
||||
public void targetClosest(){
|
||||
if(target != null) return;
|
||||
|
||||
target = Units.getClosestTarget(team, x, y, inventory.getAmmoRange());
|
||||
//target = Units.getClosestTarget(team, x, y, inventory.getAmmoRange());
|
||||
}
|
||||
|
||||
public UnitState getStartState(){
|
||||
@@ -236,11 +236,6 @@ public abstract class BaseUnit extends Unit{
|
||||
CallEntity.onUnitDeath(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesOthers() {
|
||||
return !isFlying();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void added(){
|
||||
hitbox.setSize(type.hitsize);
|
||||
|
||||
Reference in New Issue
Block a user