Cleanup
This commit is contained in:
@@ -11,7 +11,7 @@ public class FlyingAI extends AIController{
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(!unit.vel().isZero(0.01f)){
|
||||
if(unit.moving()){
|
||||
unit.rotation(unit.vel().angle());
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class FormationAI extends AIController implements FormationMember{
|
||||
if(leader.isShooting()){
|
||||
unit.aimLook(leader.aimX(), leader.aimY());
|
||||
}else{
|
||||
if(!unit.vel().isZero(0.001f)){
|
||||
if(!unit.moving()){
|
||||
unit.lookAt(unit.vel().angle());
|
||||
}else{
|
||||
unit.lookAt(leader.rotation());
|
||||
|
||||
@@ -17,11 +17,6 @@ public class GroundAI extends AIController{
|
||||
|
||||
if(Units.invalidateTarget(target, unit.team(), unit.x(), unit.y(), Float.MAX_VALUE)){
|
||||
target = null;
|
||||
|
||||
//TODO this is hacky, cleanup
|
||||
if(unit instanceof Mechc && unit.moving()){
|
||||
unit.lookAt(((Mechc)unit).baseRotation());
|
||||
}
|
||||
}
|
||||
|
||||
if(retarget()){
|
||||
@@ -51,6 +46,8 @@ public class GroundAI extends AIController{
|
||||
if(unit.type().hasWeapons()){
|
||||
unit.aimLook(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed));
|
||||
}
|
||||
}else if(unit.moving()){
|
||||
unit.lookAt(unit.vel().angle());
|
||||
}
|
||||
|
||||
unit.controlWeapons(rotate, shoot);
|
||||
|
||||
@@ -22,7 +22,7 @@ abstract class VelComp implements Posc{
|
||||
}
|
||||
|
||||
boolean moving(){
|
||||
return !vel.isZero(0.001f);
|
||||
return !vel.isZero(0.01f);
|
||||
}
|
||||
|
||||
void move(float cx, float cy){
|
||||
|
||||
@@ -563,7 +563,7 @@ public class DesktopInput extends InputHandler{
|
||||
if(aimCursor){
|
||||
unit.lookAt(mouseAngle);
|
||||
}else{
|
||||
if(!unit.vel().isZero(0.01f)){
|
||||
if(unit.moving()){
|
||||
unit.lookAt(unit.vel().angle());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user