ctf_events: Fix grenade kills not being detected (#428)

This commit is contained in:
ANAND 2019-07-10 15:49:33 +05:30 committed by GitHub
parent b289da8344
commit 99bb09def6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -120,20 +120,17 @@ function ctf_events.update_all()
end end
end end
ctf.register_on_killedplayer(function(victim, killer, stack) ctf.register_on_killedplayer(function(victim, killer, stack, tool_caps)
local sname = stack:get_name() local sname = stack:get_name()
local tool_caps = stack:get_tool_capabilities()
local type = "sword" local type = "sword"
if sname:sub(1, 8) == "shooter:" then if sname == "" then
if sname == "shooter:grenade" then
type = "grenade"
else
type = "bullet"
end
end
if tool_caps.damage_groups.grenade then if tool_caps.damage_groups.grenade then
type = "grenade" type = "grenade"
end end
elseif sname:sub(1, 8) == "shooter:" then
type = "bullet"
end
ctf_events.post("kill_" .. type, killer, victim) ctf_events.post("kill_" .. type, killer, victim)
ctf_events.update_all() ctf_events.update_all()
end) end)