Fix a load of issues, add luacheck and travis
This commit is contained in:
parent
c21b192f82
commit
7bd82dca86
28 changed files with 144 additions and 107 deletions
|
@ -24,6 +24,16 @@ local function bounty_player(target)
|
|||
|
||||
bountied_player = target
|
||||
|
||||
-- Score * K/D
|
||||
-- bounty_score = -----------, or 500 (whichever is lesser)
|
||||
-- 10000
|
||||
|
||||
local pstat, _ = ctf_stats.player(target)
|
||||
bounty_score = (pstat.score * (pstat.kills / pstat.deaths)) / 10000
|
||||
if bounty_score > 500 then
|
||||
bounty_score = 500
|
||||
end
|
||||
|
||||
minetest.after(0.1, announce_all)
|
||||
end
|
||||
|
||||
|
@ -31,7 +41,7 @@ local function bounty_find_new_target()
|
|||
local players = {}
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local pstat, mstat = ctf_stats.player(name)
|
||||
local pstat, _ = ctf_stats.player(name)
|
||||
pstat.name = name
|
||||
pstat.color = nil
|
||||
if pstat.score > 1000 and pstat.kills > pstat.deaths * 1.5 then
|
||||
|
@ -41,14 +51,6 @@ local function bounty_find_new_target()
|
|||
|
||||
if #players > 0 then
|
||||
bounty_player(players[math.random(1, #players)].name)
|
||||
|
||||
-- Score * K/D
|
||||
-- bounty_score = -----------, or 500 (whichever is lesser)
|
||||
-- 10000
|
||||
bounty_score = (pstat.score * (pstat.kills / pstat.deaths)) / 10000
|
||||
if bounty_score > 500 then
|
||||
bounty_score = 500
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(math.random(500, 1000), bounty_find_new_target)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue