From 2e98abc86e66eda24d13564ab6b0bf35c5dd9300 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Sat, 1 Oct 2022 14:42:57 -0700 Subject: [PATCH] Player-only weapons (#6010) Co-authored-by: Anuken --- core/src/mindustry/entities/units/AIController.java | 5 +++++ core/src/mindustry/type/Weapon.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/core/src/mindustry/entities/units/AIController.java b/core/src/mindustry/entities/units/AIController.java index bbdd2870b1..3ef7851a96 100644 --- a/core/src/mindustry/entities/units/AIController.java +++ b/core/src/mindustry/entities/units/AIController.java @@ -147,6 +147,11 @@ public class AIController implements UnitController{ //let uncontrollable weapons do their own thing if(!weapon.controllable || weapon.noAttack) continue; + if(!weapon.aiControllable){ + mount.rotate = false; + continue; + } + float mountX = unit.x + Angles.trnsx(rotation, weapon.x, weapon.y), mountY = unit.y + Angles.trnsy(rotation, weapon.x, weapon.y); diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 6870046bd9..16ceee125d 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -53,6 +53,8 @@ public class Weapon implements Cloneable{ public boolean alwaysContinuous; /** whether this weapon can be aimed manually by players */ public boolean controllable = true; + /** whether this weapon can be automatically aimed by the unit */ + public boolean aiControllable = true; /** whether this weapon is always shooting, regardless of targets ore cone */ public boolean alwaysShooting = false; /** whether to automatically target relevant units in update(); only works when controllable = false. */