Make AI switch to amNothing before trying to walk if it holds weapon which needs targeting (not tested)
authorunc0rr
Sat, 16 Apr 2011 23:21:15 +0400
changeset 5148 73b3b4b8359c
parent 5147 a2ae7702bb75
child 5149 9aa840fdf922
child 5150 63ad8a648afd
Make AI switch to amNothing before trying to walk if it holds weapon which needs targeting (not tested)
hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Fri Apr 15 22:38:50 2011 +0400
+++ b/hedgewars/uAI.pas	Sat Apr 16 23:21:15 2011 +0400
@@ -208,6 +208,9 @@
 BestRate:= RatePlace(Me);
 BaseRate:= Max(BestRate, 0);
 
+if (Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
+    AddAction(Actions, aia_Weapon, Longword(amNothing), 100 + random(200), 0, 0);
+
 while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do
     begin
     Pop(ticks, Actions, Me^);