Skip to content

Commit

Permalink
allow donating maximum score by donating 0 or less
Browse files Browse the repository at this point in the history
  • Loading branch information
lazylier committed Nov 2, 2024
1 parent 486cfe1 commit 02117ed
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mods/ctf/ctf_modebase/ranking_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,21 @@ ctf_core.register_chatcommand_alias("donate", "d", {
end
score = math.floor(score)

local cur_score = math.min(
current_mode.recent_rankings.get(name).score or 0,
(current_mode.rankings:get(name) or {}).score or 0
)

if score <= 0 then
score = math.floor(cur_score / 2 / pcount)
end

if score < 5 then
return false, "You should donate at least 5 score!"
end

local scoretotal = score * pcount
local cur_score = math.min(
current_mode.recent_rankings.get(name).score or 0,
(current_mode.rankings:get(name) or {}).score or 0
)

if scoretotal > cur_score / 2 then
return false, "You can donate only half of your match score!"
end
Expand Down

0 comments on commit 02117ed

Please sign in to comment.