Skip to content

Commit

Permalink
Display how much score and captures are left until pro chest access (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
a-blob authored Nov 25, 2023
1 parent 5dfebc6 commit c84c52d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion mods/ctf/ctf_modebase/features.lua
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,17 @@ return {
local pro_chest = player and player:get_meta():get_int("ctf_rankings:pro_chest:"..
(ctf_modebase.current_mode or "")) == 1
local deny_pro = "You need to have more than 1.4 kills per death, "..
"5 captures, and at least 8,000 score to access the pro section"
"5 captures, and at least 8,000 score to access the pro section."
if rank then
local captures_needed = math.max(0, 5 - (rank.flag_captures or 0))
local score_needed = math.max(0, 8000 - (rank.score or 0))
local current_kd = math.floor((rank.kills or 0) / (rank.deaths or 1) * 10)
current_kd = current_kd / 10
deny_pro = deny_pro .. " You still need " .. captures_needed
.. " captures, " .. score_needed ..
" score, and your kills per death is " ..
current_kd .. "."
end

-- Remember to update /make_pro in ranking_commands.lua if you change anything here
if pro_chest or rank then
Expand Down
2 changes: 1 addition & 1 deletion mods/ctf/ctf_teams/team_chest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ for _, team in ipairs(ctf_teams.teamlist) do
"label[7,-0.2;" ..
minetest.formspec_escape("Pro players only") .. "]"
else
formspec = formspec .. "label[6.5,3;" ..
formspec = formspec .. "label[6.5,2;" ..
minetest.formspec_escape(minetest.wrap_text(
pro_access or "You aren't allowed to access the pro section",
20
Expand Down

0 comments on commit c84c52d

Please sign in to comment.