Skip to content

Commit

Permalink
Add HUD score elements for flag pickup and capture (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClobberXD committed Mar 19, 2019
1 parent ed85e32 commit 29a0861
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion mods/ctf/ctf_stats/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ table.insert(ctf_flag.registered_on_capture, 1, function(name, flag)
ctf.needs_save = true
end
winner_player = name

hud_score.new(name, {
name = "ctf_stats:flag_capture",
color = "0xFF00FF",
value = 25
})
end)

ctf_match.register_on_winner(function(winner)
Expand Down Expand Up @@ -207,11 +213,17 @@ ctf_flag.register_on_pick_up(function(name, flag)
local main, match = ctf_stats.player(name)
if main and match then
main.attempts = main.attempts + 1
main.score = main.score + 5
main.score = main.score + 10
match.attempts = match.attempts + 1
match.score = match.score + 10
ctf.needs_save = true
end

hud_score.new(name, {
name = "ctf_stats:flag_pick_up",
color = "0xAA00AA",
value = 10
})
end)

ctf_flag.register_on_precapture(function(name, flag)
Expand Down

0 comments on commit 29a0861

Please sign in to comment.