Lua callback: onUsedAmmo, after using up an ammo
authorWuzzy <almikes@aol.com>
Tue, 04 Apr 2017 17:02:38 +0200
changeset 12156 9755922396f5
parent 12155 5ec5d0d9414c
child 12157 e837912ba85d
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
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