Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display how many score and capture is left until pro chest access #1248

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading