hedgewars/uScript.pas
changeset 9171 e72f4f37a444
parent 9080 9b42757d7e71
child 9173 575dd8fe4a55
equal deleted inserted replaced
9170:7c75643d0b66 9171:e72f4f37a444
    81     uTextures,
    81     uTextures,
    82     uLandGraphics,
    82     uLandGraphics,
    83     SDLh,
    83     SDLh,
    84     SysUtils, 
    84     SysUtils, 
    85     uIO,
    85     uIO,
    86     uPhysFSLayer
    86     uPhysFSLayer,
       
    87     typinfo
    87     ;
    88     ;
    88 
    89 
    89 var luaState : Plua_State;
    90 var luaState : Plua_State;
    90     ScriptAmmoLoadout : shortstring;
    91     ScriptAmmoLoadout : shortstring;
    91     ScriptAmmoProbability : shortstring;
    92     ScriptAmmoProbability : shortstring;
  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 begin
       
  1292 	statInfo := TStatInfoType(GetEnumValue(TypeInfo(TStatInfoType),lua_tostring(L, 1)));
       
  1293 	if lua_gettop(L) <> 2 then
       
  1294         begin
       
  1295         LuaError('Lua: Wrong number of parameters passed to SendStat!');
       
  1296         end
       
  1297     else
       
  1298 		begin
       
  1299 		SendStat(statInfo,lua_tostring(L, 2));
       
  1300 		end;
       
  1301     lc_sendstat:= 0
       
  1302 end;
       
  1303 
       
  1304 function lc_sendstats(L : Plua_State) : LongInt; Cdecl;
       
  1305 begin
       
  1306     L:= L; // avoid compiler hint
       
  1307     SendStats;
       
  1308     lc_sendstats:= 0
  1286 end;
  1309 end;
  1287 
  1310 
  1288 function lc_findplace(L : Plua_State) : LongInt; Cdecl;
  1311 function lc_findplace(L : Plua_State) : LongInt; Cdecl;
  1289 var gear: PGear;
  1312 var gear: PGear;
  1290     fall: boolean;
  1313     fall: boolean;
  2380 lua_register(luaState, _P'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate);
  2403 lua_register(luaState, _P'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate);
  2381 lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate);
  2404 lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate);
  2382 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole);
  2405 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole);
  2383 lua_register(luaState, _P'GetGearType', @lc_getgeartype);
  2406 lua_register(luaState, _P'GetGearType', @lc_getgeartype);
  2384 lua_register(luaState, _P'EndGame', @lc_endgame);
  2407 lua_register(luaState, _P'EndGame', @lc_endgame);
       
  2408 lua_register(luaState, _P'SendStat', @lc_sendstat);
       
  2409 lua_register(luaState, _P'SendStats', @lc_sendstats);
  2385 lua_register(luaState, _P'FindPlace', @lc_findplace);
  2410 lua_register(luaState, _P'FindPlace', @lc_findplace);
  2386 lua_register(luaState, _P'SetGearPosition', @lc_setgearposition);
  2411 lua_register(luaState, _P'SetGearPosition', @lc_setgearposition);
  2387 lua_register(luaState, _P'GetGearPosition', @lc_getgearposition);
  2412 lua_register(luaState, _P'GetGearPosition', @lc_getgearposition);
  2388 lua_register(luaState, _P'SetGearTarget', @lc_setgeartarget);
  2413 lua_register(luaState, _P'SetGearTarget', @lc_setgeartarget);
  2389 lua_register(luaState, _P'GetGearTarget', @lc_getgeartarget);
  2414 lua_register(luaState, _P'GetGearTarget', @lc_getgeartarget);