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
--- 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