Fix potential kill assist bug
This commit is contained in:
parent
c703733e6f
commit
88e6fb7af9
1 changed files with 6 additions and 3 deletions
|
@ -30,11 +30,14 @@ function kill_assist.add_heal_assist(victim, healed_hp)
|
||||||
end
|
end
|
||||||
|
|
||||||
function kill_assist.reward_assists(victim, killer, reward)
|
function kill_assist.reward_assists(victim, killer, reward)
|
||||||
if not kill_assists[victim] then return end
|
local max_hp = minetest.get_player_by_name(victim):get_properties().max_hp or 20
|
||||||
|
|
||||||
|
if not kill_assists[victim] then
|
||||||
|
kill_assist.add_assist(victim, killer, max_hp)
|
||||||
|
end
|
||||||
|
|
||||||
for name, damage in pairs(kill_assists[victim].players) do
|
for name, damage in pairs(kill_assists[victim].players) do
|
||||||
if name ~= "!offset" and minetest.get_player_by_name(name) then
|
if minetest.get_player_by_name(name) then
|
||||||
local max_hp = minetest.get_player_by_name(victim):get_properties().max_hp or 20
|
|
||||||
local help_percent = damage / (max_hp + kill_assists[victim].hp_offset)
|
local help_percent = damage / (max_hp + kill_assists[victim].hp_offset)
|
||||||
local main, match = ctf_stats.player(name)
|
local main, match = ctf_stats.player(name)
|
||||||
local color = "0x00FFFF"
|
local color = "0x00FFFF"
|
||||||
|
|
Loading…
Reference in a new issue