MechPad deselect / Flyer patrol tweak

This commit is contained in:
Anuken
2019-04-20 14:14:34 -04:00
parent 8a1da3c0ed
commit 52cd4a77dd
5 changed files with 15 additions and 8 deletions

View File

@ -84,7 +84,7 @@ public abstract class FlyingUnit extends BaseUnit{
});
if(target != null){
circle(60f + Mathf.absin(Time.time() + id * 23525, 70f, 1200f));
circle(60f + Mathf.absin(Time.time() + Mathf.randomSeed(id) * 1200f, 70f, 1200f));
}
}
};

View File

@ -76,8 +76,9 @@ public abstract class GroundUnit extends BaseUnit{
@Override
public void move(float x, float y){
if(Mathf.dst(x, y) > 0.01f){
baseRotation = Mathf.slerpDelta(baseRotation, Mathf.angle(x, y), type.baseRotateSpeed);
float dst = Mathf.dst(x, y);
if(dst > 0.01f){
baseRotation = Mathf.slerp(baseRotation, Mathf.angle(x, y), type.baseRotateSpeed * (dst / type.speed));
}
super.move(x, y);
}

View File

@ -8,8 +8,7 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.Tmp;
import io.anuke.arc.util.*;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Damage;
@ -250,6 +249,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
final int rad = 2;
//TODO fix units getting trapped on tile corners
moveVector.setZero();
for(int cx = -rad; cx <= rad; cx++){
for(int cy = -rad; cy <= rad; cy++){

View File

@ -126,7 +126,8 @@ public class MechPad extends Block{
if(checkValidTap(tile, player)){
Call.onMechFactoryTap(player, tile);
}else if(player.isLocal && mobile && !player.isDead() && (entity.power.satisfaction >= requiredSatisfaction) && entity.player == null){
player.moveTarget = tile.entity;
//deselect on double taps
player.moveTarget = player.moveTarget == tile.entity ? null : tile.entity;
}
}

View File

@ -77,8 +77,13 @@ public class ArcNetServer implements ServerProvider{
Core.app.post(() -> {
try{
Net.handleServerReceived(k.id, object);
}catch(ValidateException e){
Log.err("Validation failed: {0} ({1})", e.player.name, e.getMessage());
}catch(RuntimeException e){
if(e.getCause() instanceof ValidateException){
ValidateException v = (ValidateException)e.getCause();
Log.err("Validation failed: {0} ({1})", v.player.name, v.getMessage());
}else{
e.printStackTrace();
}
}catch(Exception e){
e.printStackTrace();
}