Merge branch 'master' of https://github.com/MT-CTF/capturetheflag
This commit is contained in:
commit
65118f5e72
2 changed files with 24 additions and 6 deletions
|
@ -417,6 +417,20 @@ function ctf_stats.calculateKillReward(victim, killer, toolcaps)
|
||||||
return reward
|
return reward
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ctf.register_on_killedplayer(function(victim, killer)
|
||||||
|
-- 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
|
||||||
|
main.kills = main.kills + 1
|
||||||
|
match.kills = match.kills + 1
|
||||||
|
match.kills_since_death = match.kills_since_death + 1
|
||||||
|
_needs_save = true
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
minetest.register_on_dieplayer(function(player)
|
minetest.register_on_dieplayer(function(player)
|
||||||
local main, match = ctf_stats.player(player:get_player_name())
|
local main, match = ctf_stats.player(player:get_player_name())
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,18 @@ 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
|
||||||
|
if victim ~= killer then
|
||||||
|
kill_assist.add_assist(victim, killer, max_hp)
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
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"
|
||||||
|
@ -48,9 +55,6 @@ function kill_assist.reward_assists(victim, killer, reward)
|
||||||
|
|
||||||
if name == killer then
|
if name == killer then
|
||||||
color = "0x00FF00"
|
color = "0x00FF00"
|
||||||
main.kills = main.kills + 1
|
|
||||||
match.kills = match.kills + 1
|
|
||||||
match.kills_since_death = match.kills_since_death + 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
hud_score.new(name, {
|
hud_score.new(name, {
|
||||||
|
|
Loading…
Reference in a new issue