Better support for disabling omniMovement
This commit is contained in:
@@ -76,6 +76,17 @@ abstract class MechComp implements Posc, Flyingc, Hitboxc, Unitc, Mechc, Elevati
|
||||
return raw;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Replace
|
||||
public void rotateMove(Vec2 vec){
|
||||
//mechs use baseRotation to rotate, not rotation.
|
||||
moveAt(Tmp.v2.trns(baseRotation, vec.len()));
|
||||
|
||||
if(!vec.isZero()){
|
||||
baseRotation = Angles.moveToward(baseRotation, vec.angle(), type.rotateSpeed * Math.max(Time.delta, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveAt(Vec2 vector, float acceleration){
|
||||
//mark walking state when moving in a controlled manner
|
||||
|
||||
@@ -51,6 +51,15 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
private transient boolean wasPlayer;
|
||||
private transient boolean wasHealed;
|
||||
|
||||
/** Move based on preferred unit movement type. */
|
||||
public void movePref(Vec2 movement){
|
||||
if(type.omniMovement){
|
||||
moveAt(movement);
|
||||
}else{
|
||||
rotateMove(movement);
|
||||
}
|
||||
}
|
||||
|
||||
public void moveAt(Vec2 vector){
|
||||
moveAt(vector, type.accel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user