From 3f7d21bf1820c2a9f02d0c9ebced76885a358356 Mon Sep 17 00:00:00 2001 From: Farooq Karimi Zadeh Date: Thu, 23 Mar 2023 16:21:41 +0330 Subject: [PATCH 1/2] changing definition of pro --- mods/ctf/ctf_modebase/features.lua | 17 ++++++++++------- mods/ctf/ctf_modebase/ranking_commands.lua | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mods/ctf/ctf_modebase/features.lua b/mods/ctf/ctf_modebase/features.lua index e3bdd49244..738202d37f 100644 --- a/mods/ctf/ctf_modebase/features.lua +++ b/mods/ctf/ctf_modebase/features.lua @@ -481,17 +481,20 @@ return { -- Remember to update /make_pro in ranking_commands.lua if you change anything here if rank then + if (rank.score or 0) <= 8000 then + if (rank.score or 0) >= 10 then + return true, deny_pro + else + return false, deny_pro + end + end if - (rank.score or 0) >= 8000 and - (rank.kills or 0) / (rank.deaths or 1) >= 1.4 and - (rank.flag_captures or 0) >= 5 + ((rank.kills or 0) + (rank.kill_assists or 0) * 0.34) / (rank.deaths or 1) >= 1.4 or + (rank.flag_captures or 0) / (rank.deaths or 1) >= 1/14 or + (rank.hp_healed or 0) / (rank.deaths or 1) >= 30 then return true, true end - - if (rank.score or 0) >= 10 then - return true, deny_pro - end end return "You need at least 10 score to access this chest", deny_pro diff --git a/mods/ctf/ctf_modebase/ranking_commands.lua b/mods/ctf/ctf_modebase/ranking_commands.lua index 4a97eda5cc..ce5387f242 100644 --- a/mods/ctf/ctf_modebase/ranking_commands.lua +++ b/mods/ctf/ctf_modebase/ranking_commands.lua @@ -233,7 +233,7 @@ minetest.register_chatcommand("make_pro", { return false, string.format("Player '%s' has no rankings!", pname) end - mode_data.rankings:add(pname, {score = 8000, kills = 7, deaths = 5, flag_captures = 5}) + mode_data.rankings:add(pname, {score = 8000, kills = 7, deaths = 5, flag_captures = 1, hp_healed = 100}) minetest.log("action", string.format( "[ctf_admin] %s made player '%s' a pro in mode %s: %s", name, pname, mode_name, dump(old_ranks) From 8c741fd2dc843b1fb73acff1a7137bc2b5205a45 Mon Sep 17 00:00:00 2001 From: Farooq Karimi Zadeh Date: Thu, 23 Mar 2023 16:24:53 +0330 Subject: [PATCH 2/2] making luacheck happy --- mods/ctf/ctf_modebase/features.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ctf/ctf_modebase/features.lua b/mods/ctf/ctf_modebase/features.lua index 738202d37f..3805b7802f 100644 --- a/mods/ctf/ctf_modebase/features.lua +++ b/mods/ctf/ctf_modebase/features.lua @@ -491,7 +491,7 @@ return { if ((rank.kills or 0) + (rank.kill_assists or 0) * 0.34) / (rank.deaths or 1) >= 1.4 or (rank.flag_captures or 0) / (rank.deaths or 1) >= 1/14 or - (rank.hp_healed or 0) / (rank.deaths or 1) >= 30 + (rank.hp_healed or 0) / (rank.deaths or 1) >= 30 then return true, true end