hedgewars/uScript.pas
changeset 5343 ff7ecf483759
parent 5313 5e18eaef65d0
child 5352 7f57d0c7816a
equal deleted inserted replaced
5340:6963e37f2dd2 5343:ff7ecf483759
   224 end;
   224 end;
   225 
   225 
   226 function lc_spawnfakehealthcrate(L: Plua_State) : LongInt; Cdecl;
   226 function lc_spawnfakehealthcrate(L: Plua_State) : LongInt; Cdecl;
   227 var gear: PGear;
   227 var gear: PGear;
   228 begin
   228 begin
   229     if lua_gettop(L) <> 3 then begin
   229     if lua_gettop(L) <> 4 then begin
   230         LuaError('Lua: Wrong number of parameters passed to SpawnFakeHealthCrate!');
   230         LuaError('Lua: Wrong number of parameters passed to SpawnFakeHealthCrate!');
   231         lua_pushnil(L);
   231         lua_pushnil(L);
   232     end
   232     end
   233     else begin
   233     else begin
   234         gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   234         gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   235             HealthCrate, lua_toboolean(L, 3));
   235             HealthCrate, lua_toboolean(L, 3), lua_toboolean(L, 4));
   236         lua_pushinteger(L, gear^.uid);
   236         lua_pushinteger(L, gear^.uid);
   237     end;
   237     end;
   238     lc_spawnfakehealthcrate := 1;        
   238     lc_spawnfakehealthcrate := 1;        
   239 end;
   239 end;
   240 
   240 
   241 function lc_spawnfakeammocrate(L: PLua_State): LongInt; Cdecl;
   241 function lc_spawnfakeammocrate(L: PLua_State): LongInt; Cdecl;
   242 var gear: PGear;
   242 var gear: PGear;
   243 begin
   243 begin
   244     if lua_gettop(L) <> 3 then begin
   244     if lua_gettop(L) <> 4 then begin
   245         LuaError('Lua: Wrong number of parameters passed to SpawnFakeAmmoCrate!');
   245         LuaError('Lua: Wrong number of parameters passed to SpawnFakeAmmoCrate!');
   246         lua_pushnil(L);
   246         lua_pushnil(L);
   247     end
   247     end
   248     else begin
   248     else begin
   249         gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   249         gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   250             AmmoCrate, lua_toboolean(L, 3));
   250             AmmoCrate, lua_toboolean(L, 3), lua_toboolean(L, 4));
   251         lua_pushinteger(L, gear^.uid);
   251         lua_pushinteger(L, gear^.uid);
   252     end;
   252     end;
   253     lc_spawnfakeammocrate := 1;
   253     lc_spawnfakeammocrate := 1;
   254 end;
   254 end;
   255 
   255 
   256 function lc_spawnfakeutilitycrate(L: PLua_State): LongInt; Cdecl;
   256 function lc_spawnfakeutilitycrate(L: PLua_State): LongInt; Cdecl;
   257 var gear: PGear;
   257 var gear: PGear;
   258 begin
   258 begin
   259     if lua_gettop(L) <> 3 then begin
   259     if lua_gettop(L) <> 4 then begin
   260         LuaError('Lua: Wrong number of parameters passed to SpawnFakeUtilityCrate!');
   260         LuaError('Lua: Wrong number of parameters passed to SpawnFakeUtilityCrate!');
   261         lua_pushnil(L);
   261         lua_pushnil(L);
   262     end
   262     end
   263     else begin  
   263     else begin  
   264         gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   264         gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
   265             UtilityCrate, lua_toboolean(L, 3));
   265             UtilityCrate, lua_toboolean(L, 3), lua_toboolean(L, 4));
   266         lua_pushinteger(L, gear^.uid);
   266         lua_pushinteger(L, gear^.uid);
   267     end;
   267     end;
   268     lc_spawnfakeutilitycrate := 1;
   268     lc_spawnfakeutilitycrate := 1;
   269 end;
   269 end;
   270 
   270