# HG changeset patch
# User Wuzzy <almikes@aol.com>
# Date 1491318158 -7200
# Node ID 9755922396f5d39fa5325ea6abd94d6f1794ffd6
# Parent  5ec5d0d9414c9ff700df5f5087d4766c9dad5643
Lua callback: onUsedAmmo, after using up an ammo

Useful to know when e.g. shotgun attack has finished

Syntax: onUsedAmmo(ammoType)
* ammoType: Ammo type of used ammo

Note: Not called for ammo type amNothing

Thanks to KoBeWi

diff -r 5ec5d0d9414c -r 9755922396f5 hedgewars/uAmmos.pas
--- a/hedgewars/uAmmos.pas	Tue Apr 04 05:35:11 2017 +0200
+++ b/hedgewars/uAmmos.pas	Tue Apr 04 17:02:38 2017 +0200
@@ -50,7 +50,7 @@
 var StoreCnt: LongInt;
 
 implementation
-uses uVariables, uCommands, uUtils, uCaptions, uDebug;
+uses uVariables, uCommands, uUtils, uCaptions, uDebug, uScript;
 
 type TAmmoCounts = array[TAmmoType] of Longword;
      TAmmoArray = array[TAmmoType] of TAmmo;
@@ -287,6 +287,8 @@
 CurWeapon:= GetCurAmmoEntry(Hedgehog);
 with Hedgehog do
     begin
+    if CurAmmoType <> amNothing then
+        ScriptCall('onUsedAmmo', ord(CurAmmoType));
 
     MultiShootAttacks:= 0;
     with CurWeapon^ do