From 1dd0295c45e6ea6f0967f291b41ff3a58ab7202c Mon Sep 17 00:00:00 2001 From: DeltaNedas <39013340+DeltaNedas@users.noreply.github.com> Date: Sat, 4 Jan 2020 17:15:43 +0000 Subject: [PATCH] make turnCursor: false mechs not cross eyed (#1301) * create new branch * add targetDistance to weapons for mechs players will use if turnCursor is false --- core/src/mindustry/entities/type/Player.java | 2 +- core/src/mindustry/type/Weapon.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/type/Player.java b/core/src/mindustry/entities/type/Player.java index 4077da0e4e..6f28acb17c 100644 --- a/core/src/mindustry/entities/type/Player.java +++ b/core/src/mindustry/entities/type/Player.java @@ -637,7 +637,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ if(!state.isEditor() && isShooting() && mech.canShoot(this)){ if(!mech.turnCursor){ //shoot forward ignoring cursor - mech.weapon.update(this, x + Angles.trnsx(rotation, 1f), y + Angles.trnsy(rotation, 1f)); + mech.weapon.update(this, x + Angles.trnsx(rotation, mech.weapon.targetDistance), y + Angles.trnsy(rotation, mech.weapon.targetDistance)); }else{ mech.weapon.update(this, pointerX, pointerY); } diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 0e3583a552..175abd1d24 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -55,6 +55,8 @@ public class Weapon{ public float shotDelay = 0; /** whether shooter rotation is ignored when shooting. */ public boolean ignoreRotation = false; + /** if turnCursor is false for a mech, how far away will the weapon target. */ + public float targetDistance = 1f; public Sound shootSound = Sounds.pew;