hedgewars/uScript.pas
changeset 5277 09beef0752ab
parent 5272 a85d331ab5bb
child 5313 5e18eaef65d0
--- a/hedgewars/uScript.pas	Tue Jun 21 22:43:55 2011 +0400
+++ b/hedgewars/uScript.pas	Tue Jun 21 20:49:47 2011 +0200
@@ -851,6 +851,31 @@
     lc_switchhog:= 0
 end;
 
+{function lc_addammo(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+
+    if lua_gettop(L) = 3 then
+    begin
+	gear:= GearByUID(lua_tointeger(L, 1));
+        if (gear <> nil) and (gear^.Hedgehog <> nil) then
+            AddAmmoAmount(gear^.Hedgehog^, TAmmoType(lua_tointeger(L, 2)), lua_tointeger(L,3) );
+    end else
+    
+    if lua_gettop(L) = 2 then
+    begin
+	gear:= GearByUID(lua_tointeger(L, 1));
+        if (gear <> nil) and (gear^.Hedgehog <> nil) then
+            AddAmmo(gear^.Hedgehog^, TAmmoType(lua_tointeger(L, 2)));
+    end else
+    begin
+    	LuaError('Lua: Wrong number of parameters passed to AddAmmo!');
+    end;
+
+    lc_addammo:= 0;
+
+end;}
+
 function lc_addammo(L : Plua_State) : LongInt; Cdecl;
 var gear : PGear;
 begin