LuaAPI: fix OnHogAttack the incorrect AmmoType (amNothing) under certain conditions. Thanks for CheezeMonkey for reporting this
--- a/hedgewars/uGearsHedgehog.pas Wed May 27 10:37:12 2015 -0400
+++ b/hedgewars/uGearsHedgehog.pas Tue May 26 23:29:53 2015 +0200
@@ -213,6 +213,7 @@
speech: PVisualGear;
newGear: PGear;
CurWeapon: PAmmo;
+ usedAmmoType: TAmmoType;
altUse: boolean;
elastic: hwFloat;
begin
@@ -222,6 +223,7 @@
with Gear^,
Gear^.Hedgehog^ do
begin
+ usedAmmoType:= CurAmmoType;
if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstChooseTarget)) = 0) and (((State and gstMoving) = 0)
or (Power > 0)
or (CurAmmoType = amTeleport)
@@ -509,7 +511,7 @@
else
Message:= Message and (not gmAttack);
- ScriptCall('onHogAttack', ord(CurAmmoType));
+ ScriptCall('onHogAttack', ord(usedAmmoType));
end; // of with Gear^, Gear^.Hedgehog^ do
TargetPoint.X := NoPointX;