Add bounty kills to stats
This commit is contained in:
parent
cf81d194f9
commit
12d7228ff0
3 changed files with 10 additions and 2 deletions
|
@ -88,6 +88,10 @@ ctf.register_on_killedplayer(function(victim, killer)
|
|||
|
||||
local msg = killer .. " has killed " .. victim .. " and received the prize!"
|
||||
minetest.chat_send_all(msg)
|
||||
|
||||
local pstats, mstats = ctf_stats.player(killer)
|
||||
pstats.bounty_kills = pstats.bounty_kills + 1
|
||||
mstats.bounty_kills = mstats.bounty_kills + 1
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
@ -77,10 +77,10 @@ function ctf_stats.get_formspec(title, players, header)
|
|||
ret = ret .. "container[0,"..header.."]"
|
||||
|
||||
ret = ret .. "vertlabel[0,0;" .. title .. "]"
|
||||
ret = ret .. "tablecolumns[color;text;text;text;text;text;text;text;text]"
|
||||
ret = ret .. "tablecolumns[color;text;text;text;text;text;text;text;text;text]"
|
||||
ret = ret .. "tableoptions[highlight=#00000000]"
|
||||
ret = ret .. "table[0.5,0;11.25,6;scores;"
|
||||
ret = ret .. "#ffffff,,username,kills,deaths,K/D ratio,captures,attempts,score"
|
||||
ret = ret .. "#ffffff,,Player,Kills,Deaths,K/D ratio,Bounty kills,Captures,Attempts,Score"
|
||||
|
||||
for i = 1, #players do
|
||||
local pstat = players[i]
|
||||
|
@ -96,6 +96,7 @@ function ctf_stats.get_formspec(title, players, header)
|
|||
"," .. pstat.kills ..
|
||||
"," .. pstat.deaths ..
|
||||
"," .. math.floor(kd*10)/10 ..
|
||||
"," .. pstat.bounty_kills ..
|
||||
"," .. pstat.captures ..
|
||||
"," .. pstat.attempts ..
|
||||
"," .. math.floor(pstat.score*10)/10
|
||||
|
|
|
@ -118,6 +118,8 @@ function ctf_stats.player(name)
|
|||
ctf_stats.players[name] = player_stats
|
||||
end
|
||||
|
||||
player_stats.bounty_kills = player_stats.bounty_kills or 0
|
||||
|
||||
local match_player_stats =
|
||||
ctf_stats.current.red[name] or ctf_stats.current.blue[name]
|
||||
|
||||
|
@ -132,6 +134,7 @@ ctf.register_on_join_team(function(name, tname)
|
|||
attempts = 0,
|
||||
captures = 0,
|
||||
score = 0,
|
||||
bounty_kills = 0,
|
||||
}
|
||||
end)
|
||||
|
||||
|
|
Loading…
Reference in a new issue