221 else |
221 else |
222 LuaError('Lua: Wrong number of parameters passed to CampaignUnlock!'); |
222 LuaError('Lua: Wrong number of parameters passed to CampaignUnlock!'); |
223 lc_campaignunlock:= 0; |
223 lc_campaignunlock:= 0; |
224 end; |
224 end; |
225 |
225 |
|
226 function lc_spawnfakehealthcrate(L: Plua_State) : LongInt; Cdecl; |
|
227 var gear: PGear; |
|
228 begin |
|
229 if lua_gettop(L) <> 3 then begin |
|
230 LuaError('Lua: Wrong number of parameters passed to SpawnFakeHealthCrate!'); |
|
231 lua_pushnil(L); |
|
232 end |
|
233 else begin |
|
234 gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), |
|
235 HealthCrate, lua_toboolean(L, 3)); |
|
236 lua_pushinteger(L, gear^.uid); |
|
237 end; |
|
238 lc_spawnfakehealthcrate := 1; |
|
239 end; |
|
240 |
|
241 function lc_spawnfakeammocrate(L: PLua_State): LongInt; Cdecl; |
|
242 var gear: PGear; |
|
243 begin |
|
244 if lua_gettop(L) <> 3 then begin |
|
245 LuaError('Lua: Wrong number of parameters passed to SpawnFakeAmmoCrate!'); |
|
246 lua_pushnil(L); |
|
247 end |
|
248 else begin |
|
249 gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), |
|
250 AmmoCrate, lua_toboolean(L, 3)); |
|
251 lua_pushinteger(L, gear^.uid); |
|
252 end; |
|
253 lc_spawnfakeammocrate := 1; |
|
254 end; |
|
255 |
|
256 function lc_spawnfakeutilitycrate(L: PLua_State): LongInt; Cdecl; |
|
257 var gear: PGear; |
|
258 begin |
|
259 if lua_gettop(L) <> 3 then begin |
|
260 LuaError('Lua: Wrong number of parameters passed to SpawnFakeUtilityCrate!'); |
|
261 lua_pushnil(L); |
|
262 end |
|
263 else begin |
|
264 gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), |
|
265 UtilityCrate, lua_toboolean(L, 3)); |
|
266 lua_pushinteger(L, gear^.uid); |
|
267 end; |
|
268 lc_spawnfakeutilitycrate := 1; |
|
269 end; |
|
270 |
226 function lc_spawnhealthcrate(L: Plua_State) : LongInt; Cdecl; |
271 function lc_spawnhealthcrate(L: Plua_State) : LongInt; Cdecl; |
227 var gear: PGear; |
272 var gear: PGear; |
228 begin |
273 var health: LongInt; |
229 if lua_gettop(L) <> 2 then begin |
274 begin |
|
275 if (lua_gettop(L) < 2) or (lua_gettop(L) > 3) then begin |
230 LuaError('Lua: Wrong number of parameters passed to SpawnHealthCrate!'); |
276 LuaError('Lua: Wrong number of parameters passed to SpawnHealthCrate!'); |
231 lua_pushnil(L); |
277 lua_pushnil(L); |
232 end |
278 end |
233 else begin |
279 else begin |
|
280 if lua_gettop(L) = 3 then health:= lua_tointeger(L, 3) |
|
281 else health:= cHealthCaseAmount; |
234 gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), |
282 gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), |
235 HealthCrate, 0); |
283 HealthCrate, health); |
236 lua_pushinteger(L, gear^.uid); |
284 lua_pushinteger(L, gear^.uid); |
237 end; |
285 end; |
238 lc_spawnhealthcrate := 1; |
286 lc_spawnhealthcrate := 1; |
239 end; |
287 end; |
240 |
288 |
1738 lua_register(luaState, 'GetVisualGearValues', @lc_getvisualgearvalues); |
1786 lua_register(luaState, 'GetVisualGearValues', @lc_getvisualgearvalues); |
1739 lua_register(luaState, 'SetVisualGearValues', @lc_setvisualgearvalues); |
1787 lua_register(luaState, 'SetVisualGearValues', @lc_setvisualgearvalues); |
1740 lua_register(luaState, 'SpawnHealthCrate', @lc_spawnhealthcrate); |
1788 lua_register(luaState, 'SpawnHealthCrate', @lc_spawnhealthcrate); |
1741 lua_register(luaState, 'SpawnAmmoCrate', @lc_spawnammocrate); |
1789 lua_register(luaState, 'SpawnAmmoCrate', @lc_spawnammocrate); |
1742 lua_register(luaState, 'SpawnUtilityCrate', @lc_spawnutilitycrate); |
1790 lua_register(luaState, 'SpawnUtilityCrate', @lc_spawnutilitycrate); |
|
1791 lua_register(luaState, 'SpawnFakeHealthCrate', @lc_spawnfakehealthcrate); |
|
1792 lua_register(luaState, 'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate); |
|
1793 lua_register(luaState, 'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate); |
1743 lua_register(luaState, 'WriteLnToConsole', @lc_writelntoconsole); |
1794 lua_register(luaState, 'WriteLnToConsole', @lc_writelntoconsole); |
1744 lua_register(luaState, 'GetGearType', @lc_getgeartype); |
1795 lua_register(luaState, 'GetGearType', @lc_getgeartype); |
1745 lua_register(luaState, 'EndGame', @lc_endgame); |
1796 lua_register(luaState, 'EndGame', @lc_endgame); |
1746 lua_register(luaState, 'FindPlace', @lc_findplace); |
1797 lua_register(luaState, 'FindPlace', @lc_findplace); |
1747 lua_register(luaState, 'SetGearPosition', @lc_setgearposition); |
1798 lua_register(luaState, 'SetGearPosition', @lc_setgearposition); |