1281 function lc_endgame(L : Plua_State) : LongInt; Cdecl; |
1282 function lc_endgame(L : Plua_State) : LongInt; Cdecl; |
1282 begin |
1283 begin |
1283 L:= L; // avoid compiler hint |
1284 L:= L; // avoid compiler hint |
1284 AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000); |
1285 AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000); |
1285 lc_endgame:= 0 |
1286 lc_endgame:= 0 |
|
1287 end; |
|
1288 |
|
1289 function lc_sendstat(L : Plua_State) : LongInt; Cdecl; |
|
1290 var statInfo : TStatInfoType; |
|
1291 var i : LongInt; |
|
1292 var color : shortstring; |
|
1293 begin |
|
1294 statInfo := TStatInfoType(GetEnumValue(TypeInfo(TStatInfoType),lua_tostring(L, 1))); |
|
1295 if (lua_gettop(L) <> 2) and ((statInfo <> siPlayerKills) |
|
1296 and (statInfo <> siClanHealth)) then |
|
1297 begin |
|
1298 LuaError('Lua: Wrong number of parameters passed to SendStat! Expected 2 parameters.'); |
|
1299 end |
|
1300 else if (lua_gettop(L) <> 3) and ((statInfo = siPlayerKills) |
|
1301 or (statInfo = siClanHealth)) then |
|
1302 begin |
|
1303 LuaError('Lua: Wrong number of parameters passed to SendStat! Expected 3 parameters.'); |
|
1304 end |
|
1305 else |
|
1306 begin |
|
1307 if ((statInfo = siPlayerKills) or (statInfo = siClanHealth)) then |
|
1308 begin |
|
1309 // 3: team name |
|
1310 for i:= 0 to Pred(TeamsCount) do |
|
1311 begin |
|
1312 with TeamsArray[i]^ do |
|
1313 begin |
|
1314 if TeamName = lua_tostring(L, 3) then |
|
1315 begin |
|
1316 color := uUtils.IntToStr(Clan^.Color); |
|
1317 Break; |
|
1318 end |
|
1319 end |
|
1320 end; |
|
1321 if (statInfo = siPlayerKills) then |
|
1322 begin |
|
1323 SendStat(siPlayerKills, color + ' ' + |
|
1324 lua_tostring(L, 2) + ' ' + TeamsArray[i]^.TeamName); |
|
1325 end |
|
1326 else if (statInfo = siClanHealth) then |
|
1327 begin |
|
1328 SendStat(siClanHealth, color + ' ' + |
|
1329 lua_tostring(L, 2)); |
|
1330 end |
|
1331 end |
|
1332 else |
|
1333 begin |
|
1334 SendStat(statInfo,lua_tostring(L, 2)); |
|
1335 end; |
|
1336 end; |
|
1337 lc_sendstat:= 0 |
|
1338 end; |
|
1339 |
|
1340 function lc_sendhealthstatsoff(L : Plua_State) : LongInt; Cdecl; |
|
1341 begin |
|
1342 L:= L; // avoid compiler hint |
|
1343 uStats.SendHealthStatsOn := false; |
|
1344 lc_sendhealthstatsoff:= 0 |
1286 end; |
1345 end; |
1287 |
1346 |
1288 function lc_findplace(L : Plua_State) : LongInt; Cdecl; |
1347 function lc_findplace(L : Plua_State) : LongInt; Cdecl; |
1289 var gear: PGear; |
1348 var gear: PGear; |
1290 fall: boolean; |
1349 fall: boolean; |
2380 lua_register(luaState, _P'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate); |
2439 lua_register(luaState, _P'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate); |
2381 lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate); |
2440 lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate); |
2382 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole); |
2441 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole); |
2383 lua_register(luaState, _P'GetGearType', @lc_getgeartype); |
2442 lua_register(luaState, _P'GetGearType', @lc_getgeartype); |
2384 lua_register(luaState, _P'EndGame', @lc_endgame); |
2443 lua_register(luaState, _P'EndGame', @lc_endgame); |
|
2444 lua_register(luaState, _P'SendStat', @lc_sendstat); |
|
2445 lua_register(luaState, _P'SendHealthStatsOff', @lc_sendhealthstatsoff); |
2385 lua_register(luaState, _P'FindPlace', @lc_findplace); |
2446 lua_register(luaState, _P'FindPlace', @lc_findplace); |
2386 lua_register(luaState, _P'SetGearPosition', @lc_setgearposition); |
2447 lua_register(luaState, _P'SetGearPosition', @lc_setgearposition); |
2387 lua_register(luaState, _P'GetGearPosition', @lc_getgearposition); |
2448 lua_register(luaState, _P'GetGearPosition', @lc_getgearposition); |
2388 lua_register(luaState, _P'SetGearTarget', @lc_setgeartarget); |
2449 lua_register(luaState, _P'SetGearTarget', @lc_setgeartarget); |
2389 lua_register(luaState, _P'GetGearTarget', @lc_getgeartarget); |
2450 lua_register(luaState, _P'GetGearTarget', @lc_getgeartarget); |