Просмотр исходного кода

修复待攻击单位不可到达时,会一直卡原地不动的bug

大爷 1 год назад
Родитель
Сommit
8538c39770

+ 4 - 5
Common/CommonAI/Zone/Helper/Motions.cs

@@ -748,16 +748,14 @@ namespace CommonAI.Zone.Helper
                                 }
                             }
                         }
-                        else if ((result.result & MoveResult.MOVE_RESULT_TOUCH_MAP_ALL) != 0)
+                        else if ((result.result & MoveResult.MOVE_RESULT_TOUCH_MAP_ALL) != 0 && (result.result & MoveResult.MOVE_RESULT_MIN_STEP) != 0)
                         {
-                            if ((result.result & MoveResult.MOVE_RESULT_MIN_STEP) != 0)
-                            {
-                                turnMap.Start(next_path.PosX, next_path.PosY);
-                            }
+                            turnMap.Start(next_path.PosX, next_path.PosY);
                         }
                         else if ((result.result & MoveResult.MOVE_RESULT_NO_WAY) != 0)
                         {
                             next_path = null;
+                            IsNoWay = true;
                             //unit.faceTo(TargetX, TargetY);
                             //result = unit.moveBlockTo(TargetX, TargetY, unit.MoveSpeedSEC, zone.UpdateIntervalMS);
                         }
@@ -765,6 +763,7 @@ namespace CommonAI.Zone.Helper
                         {
                             Hold();
                             next_path = null;
+                            IsNoWay = true;
                             return result;
                         }
                     //}

+ 5 - 2
Common/CommonAI/Zone/Instance/InstanceZoneObject.cs

@@ -796,9 +796,12 @@ namespace CommonAI.Zone.Instance
                 ddx = Math.Abs(mPos.X - oldx);
                 ddy = Math.Abs(mPos.Y - oldy);
                 float minstep = Parent.MinStep;
-                if (ddx < minstep && ddy < minstep)
+                if (ddx > 0 || ddy > 0)
                 {
-                    result.result |= MoveResult.MOVE_RESULT_MIN_STEP;
+                    if (ddx < minstep && ddy < minstep)
+                    {
+                        result.result |= MoveResult.MOVE_RESULT_MIN_STEP;
+                    }
                 }
                 return result;
             }