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