mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-02 03:00:29 +03:00
Fixed #12410
This commit is contained in:
@@ -808,7 +808,7 @@ public class NetServer implements ApplicationListener{
|
||||
|
||||
if(!player.dead()){
|
||||
unit.controlWeapons(shooting, shooting);
|
||||
unit.aim(pointerX, pointerY);
|
||||
unit.aim(pointerX, pointerY, true);
|
||||
unit.mineTile = mining;
|
||||
|
||||
long elapsed = Math.min(Time.timeSinceMillis(con.lastReceivedClientTime), 1500);
|
||||
|
||||
@@ -53,6 +53,11 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
||||
|
||||
/** Aim at something. This will make all mounts point at it. */
|
||||
void aim(float x, float y){
|
||||
aim(x, y, false);
|
||||
}
|
||||
|
||||
/** Aim at something. This will make all mounts point at it. */
|
||||
void aim(float x, float y, boolean clearTarget){
|
||||
Tmp.v1.set(x, y).sub(this.x, this.y);
|
||||
if(Tmp.v1.len() < type.aimDst) Tmp.v1.setLength(type.aimDst);
|
||||
|
||||
@@ -61,6 +66,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
||||
|
||||
for(WeaponMount mount : mounts){
|
||||
if(mount.weapon.controllable){
|
||||
if(clearTarget) mount.target = null;
|
||||
mount.aimX = x;
|
||||
mount.aimY = y;
|
||||
}
|
||||
|
||||
@@ -1003,7 +1003,7 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
unit.movePref(movement);
|
||||
|
||||
unit.aim(Core.input.mouseWorld());
|
||||
unit.aim(input.mouseWorldX(), input.mouseWorldY(), true);
|
||||
unit.controlWeapons(true, player.shooting && !boosted);
|
||||
|
||||
player.boosting = Core.input.keyDown(Binding.boost);
|
||||
|
||||
@@ -1084,7 +1084,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
//autofire targeting
|
||||
if(manualShooting){
|
||||
player.shooting = !boosted;
|
||||
unit.aim(player.mouseX = Core.input.mouseWorldX(), player.mouseY = Core.input.mouseWorldY());
|
||||
unit.aim(player.mouseX = Core.input.mouseWorldX(), player.mouseY = Core.input.mouseWorldY(), true);
|
||||
}else if(target == null){
|
||||
player.shooting = false;
|
||||
if(Core.settings.getBool("autotarget") && !(player.unit() instanceof BlockUnitUnit u && u.tile() instanceof ControlBlock c && !c.shouldAutoTarget())){
|
||||
@@ -1102,7 +1102,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
//when not shooting, aim at mouse cursor
|
||||
//this may be a bad idea, aiming for a point far in front could work better, test it out
|
||||
unit.aim(Core.input.mouseWorldX(), Core.input.mouseWorldY());
|
||||
unit.aim(Core.input.mouseWorldX(), Core.input.mouseWorldY(), true);
|
||||
}else{
|
||||
Vec2 intercept = player.unit().type.weapons.contains(w -> w.predictTarget) ? Predict.intercept(unit, target, type.weapons.first().bullet) : Tmp.v1.set(target);
|
||||
|
||||
@@ -1110,7 +1110,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
player.mouseY = intercept.y;
|
||||
player.shooting = !boosted;
|
||||
|
||||
unit.aim(player.mouseX, player.mouseY);
|
||||
unit.aim(player.mouseX, player.mouseY, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user