Handle kill weapon type in ctf_events instead of ctf_pvp_engine

This commit is contained in:
ClobberXD 2018-12-31 22:30:52 +05:30 committed by rubenwardy
parent 12c1a2501b
commit 86cb53e185

View file

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