Delegate doing tool damage to player to tool

This commit is contained in:
rakiru 2015-02-14 05:34:45 +00:00
parent 97ca7cbd0f
commit b4d1073eae

View File

@ -676,6 +676,9 @@ network.sys_handle_c2s(PKT_PLR_GUN_HIT, "BB", nwdec_plrset(function (neth, cli,
if tplr then if tplr then
if styp >= 1 and styp <= 3 then if styp >= 1 and styp <= 3 then
local tool = plr.tools[plr.tool+1] local tool = plr.tools[plr.tool+1]
if tool.hit_player ~= nil then
tool.hit_player(tplr, styp)
else
if tool.get_damage then if tool.get_damage then
local dmg, dtype local dmg, dtype
dmg, dtype = tool.get_damage(styp, tplr) dmg, dtype = tool.get_damage(styp, tplr)
@ -685,6 +688,7 @@ network.sys_handle_c2s(PKT_PLR_GUN_HIT, "BB", nwdec_plrset(function (neth, cli,
end end
end end
end end
end
end)) end))
network.sys_handle_c2s(PKT_PLR_TOOL, "BB", nwdec_plrset(function (neth, cli, plr, sec_current, tpid, tool, pkt) network.sys_handle_c2s(PKT_PLR_TOOL, "BB", nwdec_plrset(function (neth, cli, plr, sec_current, tpid, tool, pkt)
if plr and tool >= 0 and tool <= 3 then if plr and tool >= 0 and tool <= 3 then