Give capturers 10% of the match score (Limited 50-750) (#700)

* Give capturers 10% of the match.score or 50 points

* limit max capturing score to 750

* fix my commit

* OKAY OKAY I'll make it i

* missed the most important part
This commit is contained in:
KaylebJay 2020-11-24 13:32:18 -07:00 committed by GitHub
parent 7cfb2e6921
commit a48be11d74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -226,12 +226,23 @@ ctf_stats.winner_team = "-"
ctf_stats.winner_player = "-"
table.insert(ctf_flag.registered_on_capture, 1, function(name, flag)
local score = 0
for i, pstat in pairs(ctf_stats.current.red) do
score = score + pstat.score
end
for i, pstat in pairs(ctf_stats.current.blue) do
score = score + pstat.score
end
local capturereward = math.floor(score * 10) / 100
if capturereward < 50 then capturereward = 50 end
if capturereward > 750 then capturereward = 750 end
local main, match = ctf_stats.player(name)
if main and match then
main.captures = main.captures + 1
main.score = main.score + 50
main.score = main.score + capturereward
match.captures = match.captures + 1
match.score = match.score + 50
match.score = match.score + capturereward
_needs_save = true
end
ctf_stats.winner_player = name
@ -239,7 +250,7 @@ table.insert(ctf_flag.registered_on_capture, 1, function(name, flag)
hud_score.new(name, {
name = "ctf_stats:flag_capture",
color = "0xFF00FF",
value = 50
value = capturereward
})
end)