hedgewars/uScript.pas
changeset 5703 637fb1e6487b
parent 5678 35aa435d19f9
child 5725 e27100a0e2d0
child 5825 a6eab1b7c00d
equal deleted inserted replaced
5702:944849ec04bf 5703:637fb1e6487b
   277         lua_pushnil(L);
   277         lua_pushnil(L);
   278     end
   278     end
   279     else begin
   279     else begin
   280         if lua_gettop(L) = 3 then health:= lua_tointeger(L, 3)
   280         if lua_gettop(L) = 3 then health:= lua_tointeger(L, 3)
   281         else health:= cHealthCaseAmount;
   281         else health:= cHealthCaseAmount;
   282         gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   282         gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), HealthCrate, health);
   283             HealthCrate, health);
   283         if gear <> nil then lua_pushinteger(L, gear^.uid)
   284         lua_pushinteger(L, gear^.uid);
   284         else lua_pushnil(L);
   285     end;
   285     end;
   286     lc_spawnhealthcrate := 1;        
   286     lc_spawnhealthcrate := 1;        
   287 end;
   287 end;
   288 
   288 
   289 function lc_spawnammocrate(L: PLua_State): LongInt; Cdecl;
   289 function lc_spawnammocrate(L: PLua_State): LongInt; Cdecl;
   292     if lua_gettop(L) <> 3 then begin
   292     if lua_gettop(L) <> 3 then begin
   293         LuaError('Lua: Wrong number of parameters passed to SpawnAmmoCrate!');
   293         LuaError('Lua: Wrong number of parameters passed to SpawnAmmoCrate!');
   294         lua_pushnil(L);
   294         lua_pushnil(L);
   295     end
   295     end
   296     else begin
   296     else begin
   297         gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   297         gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3));
   298             AmmoCrate, lua_tointeger(L, 3));
   298         if gear <> nil then lua_pushinteger(L, gear^.uid)
   299         lua_pushinteger(L, gear^.uid);
   299         else lua_pushnil(L);
   300     end;
   300     end;
   301     lc_spawnammocrate := 1;
   301     lc_spawnammocrate := 1;
   302 end;
   302 end;
   303 
   303 
   304 function lc_spawnutilitycrate(L: PLua_State): LongInt; Cdecl;
   304 function lc_spawnutilitycrate(L: PLua_State): LongInt; Cdecl;
   309         lua_pushnil(L);
   309         lua_pushnil(L);
   310     end
   310     end
   311     else begin  
   311     else begin  
   312         gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   312         gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   313             UtilityCrate, lua_tointeger(L, 3));
   313             UtilityCrate, lua_tointeger(L, 3));
   314         lua_pushinteger(L, gear^.uid);
   314         if gear <> nil then lua_pushinteger(L, gear^.uid)
       
   315         else lua_pushnil(L);
   315     end;
   316     end;
   316     lc_spawnutilitycrate := 1;
   317     lc_spawnutilitycrate := 1;
   317 end;
   318 end;
   318 
   319 
   319 function lc_addgear(L : Plua_State) : LongInt; Cdecl;
   320 function lc_addgear(L : Plua_State) : LongInt; Cdecl;