--- a/hedgewars/uScript.pas Tue Jul 03 22:44:50 2012 +0400
+++ b/hedgewars/uScript.pas Wed Jul 04 10:56:42 2012 -0400
@@ -322,7 +322,7 @@
health:= lua_tointeger(L, 3)
else
health:= cHealthCaseAmount;
- gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), HealthCrate, health);
+ gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), HealthCrate, health, 0);
if gear <> nil then
lua_pushinteger(L, gear^.uid)
else
@@ -334,14 +334,16 @@
function lc_spawnammocrate(L: PLua_State): LongInt; Cdecl;
var gear: PGear;
begin
- if lua_gettop(L) <> 3 then
+ if (lua_gettop(L) <> 3) and (lua_gettop(L) <> 4) then
begin
LuaError('Lua: Wrong number of parameters passed to SpawnAmmoCrate!');
lua_pushnil(L);
end
else
begin
- gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3));
+ if (lua_gettop(L) <> 3) then
+ gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3), 0)
+ else gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3), lua_tointeger(L, 4));
if gear <> nil then
lua_pushinteger(L, gear^.uid)
else
@@ -353,15 +355,16 @@
function lc_spawnutilitycrate(L: PLua_State): LongInt; Cdecl;
var gear: PGear;
begin
- if lua_gettop(L) <> 3 then
+ if (lua_gettop(L) <> 3) and (lua_gettop(L) <> 4) then
begin
LuaError('Lua: Wrong number of parameters passed to SpawnUtilityCrate!');
lua_pushnil(L);
end
else
- begin
- gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
- UtilityCrate, lua_tointeger(L, 3));
+ begin
+ if (lua_gettop(L) <> 3) then
+ gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), UtilityCrate, lua_tointeger(L, 3), 0)
+ else gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), UtilityCrate, lua_tointeger(L, 3), lua_tointeger(L, 4));
if gear <> nil then
lua_pushinteger(L, gear^.uid)
else