Merge branch 'master' into cleanup-2
This commit is contained in:
@@ -481,8 +481,8 @@ public class DesktopInput extends InputHandler{
|
||||
deleting = true;
|
||||
}else if(selected != null){
|
||||
//only begin shooting if there's no cursor event
|
||||
if(!tileTapped(selected.build) && !tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && (player.builder().plans().size == 0 || !player.builder().updateBuilding()) && !droppingItem &&
|
||||
!tryBeginMine(selected) && player.miner().mineTile() == null && !Core.scene.hasKeyboard()){
|
||||
if(!tileTapped(selected.build) && !tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && !player.builder().activelyBuilding() && !droppingItem &&
|
||||
!tryBeginMine(selected) && player.miner().mineTile() == null && !Core.scene.hasKeyboard()){
|
||||
player.shooting = shouldShoot;
|
||||
}
|
||||
}else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine
|
||||
@@ -603,13 +603,6 @@ public class DesktopInput extends InputHandler{
|
||||
boolean ground = unit.isGrounded();
|
||||
|
||||
float strafePenalty = ground ? 1f : Mathf.lerp(1f, unit.type.strafePenalty, Angles.angleDist(unit.vel().angle(), unit.rotation()) / 180f);
|
||||
float baseSpeed = unit.type.speed;
|
||||
|
||||
//limit speed to minimum formation speed to preserve formation
|
||||
if(unit.isCommanding()){
|
||||
//add a tiny multiplier to let units catch up just in case
|
||||
baseSpeed = unit.minFormationSpeed * 0.95f;
|
||||
}
|
||||
|
||||
float speed = unit.realSpeed() * strafePenalty;
|
||||
float xa = Core.input.axis(Binding.move_x);
|
||||
@@ -627,9 +620,7 @@ public class DesktopInput extends InputHandler{
|
||||
if(aimCursor){
|
||||
unit.lookAt(mouseAngle);
|
||||
}else{
|
||||
if(!movement.isZero()){
|
||||
unit.lookAt(unit.vel.isZero() ? movement.angle() : unit.vel.angle());
|
||||
}
|
||||
unit.lookAt(unit.prefRotation());
|
||||
}
|
||||
|
||||
if(omni){
|
||||
|
||||
@@ -933,11 +933,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
boolean canMine(Tile tile){
|
||||
return !Core.scene.hasMouse()
|
||||
&& tile.drop() != null
|
||||
&& player.miner().validMine(tile)
|
||||
&& !(tile.floor().playerUnmineable && tile.overlay().itemDrop == null)
|
||||
&& player.unit().acceptsItem(tile.drop())
|
||||
&& tile.block() == Blocks.air;
|
||||
&& tile.drop() != null
|
||||
&& player.miner().validMine(tile)
|
||||
&& !(tile.floor().playerUnmineable && tile.overlay().itemDrop == null)
|
||||
&& player.unit().acceptsItem(tile.drop())
|
||||
&& tile.block() == Blocks.air;
|
||||
}
|
||||
|
||||
/** Returns the tile at the specified MOUSE coordinates. */
|
||||
@@ -1044,7 +1044,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
public boolean canShoot(){
|
||||
return block == null && !onConfigurable() && !isDroppingItem() && !(player.builder().updateBuilding() && player.builder().isBuilding()) &&
|
||||
return block == null && !onConfigurable() && !isDroppingItem() && !player.builder().activelyBuilding() &&
|
||||
!(player.unit() instanceof Mechc && player.unit().isFlying());
|
||||
}
|
||||
|
||||
|
||||
@@ -856,14 +856,6 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
float attractDst = 15f;
|
||||
float strafePenalty = legs ? 1f : Mathf.lerp(1f, type.strafePenalty, Angles.angleDist(unit.vel.angle(), unit.rotation) / 180f);
|
||||
|
||||
float baseSpeed = unit.type.speed;
|
||||
|
||||
//limit speed to minimum formation speed to preserve formation
|
||||
if(unit.isCommanding()){
|
||||
//add a tiny multiplier to let units catch up just in case
|
||||
baseSpeed = unit.minFormationSpeed * 0.98f;
|
||||
}
|
||||
|
||||
float speed = unit.realSpeed() * strafePenalty;
|
||||
float range = unit.hasWeapons() ? unit.range() : 0f;
|
||||
float bulletSpeed = unit.hasWeapons() ? type.weapons.first().bullet.speed : 0f;
|
||||
@@ -873,9 +865,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
if(aimCursor){
|
||||
unit.lookAt(mouseAngle);
|
||||
}else{
|
||||
if(unit.moving()){
|
||||
unit.lookAt(unit.vel.angle());
|
||||
}
|
||||
unit.lookAt(unit.prefRotation());
|
||||
}
|
||||
|
||||
if(payloadTarget != null && unit instanceof Payloadc pay){
|
||||
@@ -905,7 +895,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
if(player.within(targetPos, attractDst)){
|
||||
movement.setZero();
|
||||
unit.vel.approachDelta(Vec2.ZERO, type.speed * type.accel / 2f);
|
||||
unit.vel.approachDelta(Vec2.ZERO, unit.speed() * type.accel / 2f);
|
||||
}
|
||||
|
||||
float expansion = 3f;
|
||||
|
||||
Reference in New Issue
Block a user