From 009b5d952ccc642af3d5256ea540fc92c5b8d011 Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Sun, 27 Dec 2020 10:03:19 -0800 Subject: [PATCH] Make combat loggers give more score than usual --- mods/ctf/ctf_stats/init.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mods/ctf/ctf_stats/init.lua b/mods/ctf/ctf_stats/init.lua index e075682..19c4a07 100644 --- a/mods/ctf/ctf_stats/init.lua +++ b/mods/ctf/ctf_stats/init.lua @@ -373,7 +373,7 @@ local function invHasGoodWeapons(inv) return false end -local function calculateKillReward(victim, killer) +local function calculateKillReward(victim, killer, toolcaps) local vmain, victim_match = ctf_stats.player(victim) if not vmain or not victim_match then return 5 end @@ -401,9 +401,13 @@ local function calculateKillReward(victim, killer) reward = 5 end - -- Half if no good weapons + -- Half if no good weapons, +50% if combat logger local inv = minetest.get_inventory({ type = "player", name = victim }) - if not invHasGoodWeapons(inv) then + + if toolcaps.damage_groups.combat_log == 1 then + ctf.log("ctf_stats", "Player " .. victim .. " is a combat logger") + reward = reward * 1.5 + elseif not invHasGoodWeapons(inv) then ctf.log("ctf_stats", "Player " .. victim .. " has no good weapons") reward = reward * 0.5 else @@ -413,14 +417,14 @@ local function calculateKillReward(victim, killer) return reward end -ctf.register_on_killedplayer(function(victim, killer) +ctf.register_on_killedplayer(function(victim, killer, _, toolcaps) -- Suicide is not encouraged here at CTF if victim == killer then return end local main, match = ctf_stats.player(killer) if main and match then - local reward = calculateKillReward(victim, killer) + local reward = calculateKillReward(victim, killer, toolcaps) main.kills = main.kills + 1 main.score = main.score + reward match.kills = match.kills + 1