Improve ctf_stats

* Modified ctf_stats/init.lua

* Modified ctf_stats/init.lua

- Max. points for a kill has been increased from 150 to 200
- good_weapons list has been modified to include *all* mese and diamond implements
- Minor corrections in comments

* Delete init.lua

Was created by accident in the root directory of repo
This commit is contained in:
Anand S 2018-02-15 13:34:34 +05:30 committed by Andrew Ward
parent 11e8360639
commit 87454dd0e3

View file

@ -189,16 +189,24 @@ ctf_flag.register_on_precapture(function(name, flag)
return true return true
end) end)
-- good_weapons now includes all mese and diamond implements, and swords of steel and better
local good_weapons = { local good_weapons = {
"default:sword_steel", "default:sword_steel",
"default:sword_bronze", "default:sword_bronze",
"default:sword_mese", "default:sword_mese",
"default:sword_diamond", "default:sword_diamond",
"default:pick_mese"
"default:pick_diamond"
"default:axe_mese"
"default:axe_diamond"
"default:shovel_mese"
"default:shovel_diamond"
"shooter:grenade", "shooter:grenade",
"shooter:shotgun", "shooter:shotgun",
"shooter:rifle", "shooter:rifle",
"shooter:machine_gun", "shooter:machine_gun",
} }
local function invHasGoodWeapons(inv) local function invHasGoodWeapons(inv)
for _, weapon in pairs(good_weapons) do for _, weapon in pairs(good_weapons) do
if inv:contains_item("main", weapon) then if inv:contains_item("main", weapon) then
@ -216,7 +224,7 @@ local function calculateKillReward(victim, killer)
ctf.log("ctf_stats", "Player " .. victim .. " has made " .. reward .. ctf.log("ctf_stats", "Player " .. victim .. " has made " .. reward ..
" score worth of kills since last death") " score worth of kills since last death")
-- 15 * kd ration, with variable based on player's score -- 30 * K/D ratio, with variable based on player's score
local kdreward = 30 * vmain.kills / (vmain.deaths + 1) local kdreward = 30 * vmain.kills / (vmain.deaths + 1)
local max = vmain.score / 6 local max = vmain.score / 6
if kdreward > max then if kdreward > max then
@ -227,9 +235,9 @@ local function calculateKillReward(victim, killer)
end end
reward = reward + kdreward reward = reward + kdreward
-- Limited to 0 <= X <= 100 -- Limited to 0 <= X <= 200
if reward > 150 then if reward > 200 then
reward = 150 reward = 200
elseif reward < 14 then elseif reward < 14 then
reward = 14 reward = 14
end end