Skip to content

Commit

Permalink
subtract scoretotal from donor all at once
Browse files Browse the repository at this point in the history
  • Loading branch information
lazylier committed Jun 15, 2024
1 parent 0e8e4e8 commit 90ef617
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mods/ctf/ctf_modebase/ranking_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ minetest.register_chatcommand("donate", {
(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
return false, "You can donate only half of your match score!"

if donate_timer[name] and donate_timer[name] + 150 > os.time() then
local time_diff = donate_timer[name] + 150 - os.time()
Expand All @@ -178,10 +178,11 @@ minetest.register_chatcommand("donate", {

dmessage = (dmessage and dmessage ~= "") and (":" .. dmessage) or ""


current_mode.recent_rankings.add(name, {score=-scoretotal}, true)
local names = ""
for pname, team in pairs(pnames) do
current_mode.recent_rankings.add(pname, {score=score}, true)
current_mode.recent_rankings.add(name, {score=-score}, true)
minetest.log("action", string.format(
"Player '%s' donated %s score to player '%s'", name, score, pname
))
Expand Down

0 comments on commit 90ef617

Please sign in to comment.