Fix issues with bounty_score
* Set lower limit to bounty * Check for div-by-0 before calculating bounty_score * Rounded score after calculation * Changed the divisor from 10000 to 5000 to prevent very tiny bounties on targets
This commit is contained in:
parent
e3b12312e5
commit
b7bec9168b
1 changed files with 9 additions and 2 deletions
|
@ -26,13 +26,20 @@ local function bounty_player(target)
|
|||
|
||||
-- Score * K/D
|
||||
-- bounty_score = -----------, or 500 (whichever is lesser)
|
||||
-- 10000
|
||||
-- 5000
|
||||
|
||||
local pstat, _ = ctf_stats.player(target)
|
||||
if pstat.deaths == 0 then
|
||||
pstat.deaths = 1
|
||||
end
|
||||
bounty_score = (pstat.score * (pstat.kills / pstat.deaths)) / 10000
|
||||
if bounty_score > 500 then
|
||||
bounty_score = 500
|
||||
end
|
||||
if bounty_score < 50 then
|
||||
bounty_score = 50
|
||||
end
|
||||
bounty_score = math.floor(bounty_score)
|
||||
|
||||
minetest.after(0.1, announce_all)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue