share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
changeset 14989 5188ecbf726f
parent 14578 50f511588635
child 15069 e16f906224fd
equal deleted inserted replaced
14988:0ebecd424fc7 14989:5188ecbf726f
   434         achievements = achievements + 1
   434         achievements = achievements + 1
   435     end
   435     end
   436 
   436 
   437     -- Score and stats stuff
   437     -- Score and stats stuff
   438     local showScore = ""
   438     local showScore = ""
       
   439     local rank = 0
       
   440     local rankPlus = 1
       
   441     local prevScore
   439     table.sort(teamsSorted, function(team1, team2) return getTeamValue(team1, "Score") > getTeamValue(team2, "Score") end)
   442     table.sort(teamsSorted, function(team1, team2) return getTeamValue(team1, "Score") > getTeamValue(team2, "Score") end)
   440     for i=1, TeamsCount do
   443     for i=1, TeamsCount do
   441         SendStat(siPointType, "!POINTS")
       
   442         local score = getTeamValue(teamsSorted[i], "Score")
   444         local score = getTeamValue(teamsSorted[i], "Score")
   443         local deaths = getTeamValue(teamsSorted[i], "DeadHogs")
   445         local deaths = getTeamValue(teamsSorted[i], "DeadHogs")
       
   446         if i == 1 or score < prevScore then
       
   447             rank = rank + rankPlus
       
   448             rankPlus = 1
       
   449             prevScore = score
       
   450         else
       
   451             rankPlus = rankPlus + 1
       
   452         end
       
   453         SendStat(siPointType, "!POINTS")
       
   454         SendStat(siTeamRank, rank)
   444         SendStat(siPlayerKills, score, teamsSorted[i])
   455         SendStat(siPlayerKills, score, teamsSorted[i])
   445 
   456 
   446         showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teamsSorted[i], score, deaths) .. "|"
   457         showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teamsSorted[i], score, deaths) .. "|"
   447     end
   458     end
   448 
   459