# HG changeset patch # User unC0Rr # Date 1732292988 -3600 # Node ID fc5258d7ecb26a522fc2924d7b9d0d44b7a8c637 # Parent 6c5b3c576fc627c5f371b64a0e5edec0795e51e9 Make AI less annoying diff -r 6c5b3c576fc6 -r fc5258d7ecb2 hedgewars/uAIActions.pas --- a/hedgewars/uAIActions.pas Fri Nov 22 17:29:30 2024 +0100 +++ b/hedgewars/uAIActions.pas Fri Nov 22 17:29:48 2024 +0100 @@ -146,16 +146,23 @@ end end; -procedure CheckHang(Me: PGear); +procedure CheckHang(Me: PGear; fromLeft: boolean); +var newX: LongInt; begin -if hwRound(Me^.X) <> PrevX then +newX:= hwRound(Me^.X); +if newX <> PrevX then begin - PrevX:= hwRound(Me^.X); + if (newX < PrevX) = fromLeft then + begin + FreeActionsList + end; + + PrevX:= newX; timedelta:= 0 end else begin inc(timedelta); - if timedelta > 1700 then + if timedelta > 900 then begin timedelta:= 0; FreeActionsList @@ -196,7 +203,7 @@ end else begin - CheckHang(Me); + CheckHang(Me, false); exit end; @@ -215,7 +222,7 @@ end else begin - CheckHang(Me); + CheckHang(Me, true); exit end; aia_LookLeft: begin