hedgewars/uScript.pas
changeset 12541 e54039ea3934
parent 12499 1b483882b60f
child 12581 1fb961480b3c
equal deleted inserted replaced
12540:baee67bfa5c2 12541:e54039ea3934
  2085                 end;
  2085                 end;
  2086         end;
  2086         end;
  2087     lc_dismissteam:= 0;
  2087     lc_dismissteam:= 0;
  2088 end;
  2088 end;
  2089 
  2089 
       
  2090 function lc_getteamstats(L : Plua_State) : LongInt; Cdecl;
       
  2091 var i, h  : LongInt;
       
  2092 begin
       
  2093     if CheckLuaParamCount(L, 1, 'GetTeamStats', 'teamname') then
       
  2094         begin
       
  2095         if TeamsCount > 0 then
       
  2096             for i:= 0 to Pred(TeamsCount) do
       
  2097                 begin
       
  2098                 // skip teams that don't have matching name
       
  2099                 if TeamsArray[i]^.TeamName <> lua_tostring(L, 1) then
       
  2100                     continue;
       
  2101 
       
  2102                 lua_newtable(L);
       
  2103 
       
  2104                 lua_pushstring(L, 'Kills');
       
  2105                 lua_pushnumber(L, TeamsArray[i]^.stats.Kills);
       
  2106                 lua_settable(L, -3);
       
  2107 
       
  2108                 lua_pushstring(L, 'Suicides');
       
  2109                 lua_pushnumber(L, TeamsArray[i]^.stats.Suicides);
       
  2110                 lua_settable(L, -3);
       
  2111 
       
  2112                 lua_pushstring(L, 'AIKills');
       
  2113                 lua_pushnumber(L, TeamsArray[i]^.stats.AIKills);
       
  2114                 lua_settable(L, -3);
       
  2115 
       
  2116                 lua_pushstring(L, 'TeamKills');
       
  2117                 lua_pushnumber(L, TeamsArray[i]^.stats.TeamKills);
       
  2118                 lua_settable(L, -3);
       
  2119 
       
  2120                 lua_pushstring(L, 'TurnSkips');
       
  2121                 lua_pushnumber(L, TeamsArray[i]^.stats.TurnSkips);
       
  2122                 lua_settable(L, -3);
       
  2123 
       
  2124                 lua_pushstring(L, 'TeamDamage');
       
  2125                 lua_pushnumber(L, TeamsArray[i]^.stats.TeamDamage);
       
  2126                 lua_settable(L, -3);
       
  2127 
       
  2128                 end;
       
  2129         end
       
  2130     else
       
  2131         lua_pushnil(L);
       
  2132     lc_getteamstats:= 1;
       
  2133 end;
       
  2134 
       
  2135 
       
  2136 
  2090 function lc_addhog(L : Plua_State) : LongInt; Cdecl;
  2137 function lc_addhog(L : Plua_State) : LongInt; Cdecl;
  2091 var temp: ShortString;
  2138 var temp: ShortString;
  2092 begin
  2139 begin
  2093     if CheckLuaParamCount(L, 4, 'AddHog', 'hogname, botlevel, health, hat') then
  2140     if CheckLuaParamCount(L, 4, 'AddHog', 'hogname, botlevel, health, hat') then
  2094         begin
  2141         begin
  3517 lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate);
  3564 lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate);
  3518 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole);
  3565 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole);
  3519 lua_register(luaState, _P'GetGearType', @lc_getgeartype);
  3566 lua_register(luaState, _P'GetGearType', @lc_getgeartype);
  3520 lua_register(luaState, _P'EndGame', @lc_endgame);
  3567 lua_register(luaState, _P'EndGame', @lc_endgame);
  3521 lua_register(luaState, _P'EndTurn', @lc_endturn);
  3568 lua_register(luaState, _P'EndTurn', @lc_endturn);
       
  3569 lua_register(luaState, _P'GetTeamStats', @lc_getteamstats);
  3522 lua_register(luaState, _P'SendStat', @lc_sendstat);
  3570 lua_register(luaState, _P'SendStat', @lc_sendstat);
  3523 lua_register(luaState, _P'SendGameResultOff', @lc_sendgameresultoff);
  3571 lua_register(luaState, _P'SendGameResultOff', @lc_sendgameresultoff);
  3524 lua_register(luaState, _P'SendRankingStatsOff', @lc_sendrankingstatsoff);
  3572 lua_register(luaState, _P'SendRankingStatsOff', @lc_sendrankingstatsoff);
  3525 lua_register(luaState, _P'SendAchievementsStatsOff', @lc_sendachievementsstatsoff);
  3573 lua_register(luaState, _P'SendAchievementsStatsOff', @lc_sendachievementsstatsoff);
  3526 lua_register(luaState, _P'SendHealthStatsOff', @lc_sendhealthstatsoff);
  3574 lua_register(luaState, _P'SendHealthStatsOff', @lc_sendhealthstatsoff);