From ba72e9c50d272278de025cf2178d6d8854835bd0 Mon Sep 17 00:00:00 2001 From: Garen7 <22408776+Garen7@users.noreply.github.com> Date: Sat, 7 Jan 2023 11:54:26 -0600 Subject: [PATCH 1/2] Fixes Tanks rotating needlessly after attack commands (#8112) Co-authored-by: Garen7 --- core/src/mindustry/entities/units/AIController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/units/AIController.java b/core/src/mindustry/entities/units/AIController.java index 591d335f18..92b79cfd05 100644 --- a/core/src/mindustry/entities/units/AIController.java +++ b/core/src/mindustry/entities/units/AIController.java @@ -315,8 +315,8 @@ public class AIController implements UnitController{ vec.setLength(unit.speed() * length); } - //do not move when infinite vectors are used. - if(vec.isNaN() || vec.isInfinite()) return; + //do not move when infinite vectors are used or if its zero. + if(vec.isNaN() || vec.isInfinite() || vec.isZero()) return; if(!unit.type.omniMovement && unit.type.rotateMoveFirst){ float angle = vec.angle(); From eb0481a1da06ba0fa231a2b2e1418e32b810f27f Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Sat, 7 Jan 2023 09:55:19 -0800 Subject: [PATCH 2/2] Cargo units *will* chase you down if you pick up their target. (#8033) --- core/src/mindustry/ai/types/CargoAI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/ai/types/CargoAI.java b/core/src/mindustry/ai/types/CargoAI.java index f9572b9c3f..d09359d221 100644 --- a/core/src/mindustry/ai/types/CargoAI.java +++ b/core/src/mindustry/ai/types/CargoAI.java @@ -60,8 +60,8 @@ public class CargoAI extends AIController{ } }else{ - //what if some prankster reconfigures the source while the unit is moving? we can't have that! - if(unloadTarget.item != itemTarget){ + //what if some prankster reconfigures or picks up the target while the unit is moving? we can't have that! + if(unloadTarget.item != itemTarget || unloadTarget.isPayload()){ unloadTarget = null; return; }