make whip hit moving gears
authoralfadur
Sat, 27 Oct 2018 07:53:27 +0300
changeset 14029 967ed77d6aef
parent 14028 cfbea054754c
child 14030 d203bb36225f
make whip hit moving gears
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsHandlersMess.pas	Sat Oct 27 07:39:44 2018 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Oct 27 07:53:27 2018 +0300
@@ -2596,13 +2596,17 @@
     HHGear^.State := HHGear^.State or gstNoDamage;
     DeleteCI(HHGear);
 
+    ClearHitOrder();
+    RefillProximityCache(Gear, 100);
     for i:= 0 to 3 do
         begin
         AddVisualGear(hwRound(Gear^.X) + hwSign(Gear^.dX) * (10 + 6 * i), hwRound(Gear^.Y) + 12 + Random(6), vgtDust);
-        AmmoShove(Gear, Gear^.Boom, 25);
+        AmmoShoveCache(Gear, Gear^.Boom, 25);
         Gear^.X := Gear^.X + Gear^.dX * 5
         end;
 
+    ClearHitOrder();
+    ClearProximityCache();
     HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving;
 
     Gear^.Timer := 250;
--- a/hedgewars/uGearsUtils.pas	Sat Oct 27 07:39:44 2018 +0300
+++ b/hedgewars/uGearsUtils.pas	Sat Oct 27 07:53:27 2018 +0300
@@ -1322,7 +1322,7 @@
     dec(i);
     Gear:= t^.ar[i];
     if (Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet,
-                       gtFirePunch, gtKamikaze])
+                       gtFirePunch, gtKamikaze, gtWhip])
         and (((Ammo^.Data <> nil) and (PGear(Ammo^.Data) = Gear))
              or (not UpdateHitOrder(Gear, Ammo^.WDTimer))) then
         continue;