[1.2.5] On_hit/On_crit functions not working with archery
Posted: Sat Dec 06, 2014 11:56 am
It looks like during the update to add multiple on_hit, on_crit, on_kill effects to items, the Archery code was forgotten. Right now, non-artifact quivers/bows/slings/ammo pouches do not trigger their special functions on_hit/crit/kill. So no silencing from throat-seeking bows and no crippling from crippling arrows.
The archery code needs to look for a table of special functions as opposed for just fct. The proper code is in Combat.lua.
In Archery.lua we have:
In Combat.lua we have:
The archery code needs to look for a table of special functions as opposed for just fct. The proper code is in Combat.lua.
In Archery.lua we have:
Code: Select all
-- Special effect
if hitted and weapon and weapon.special_on_hit and weapon.special_on_hit.fct and (not target.dead or weapon.special_on_hit.on_kill) then
weapon.special_on_hit.fct(weapon, self, target)
end
-- Special effect... AMMO!
if hitted and ammo and ammo.special_on_hit and ammo.special_on_hit.fct and (not target.dead or ammo.special_on_hit.on_kill) then
ammo.special_on_hit.fct(ammo, self, target)
end
-- Special effect on crit
if crit and weapon and weapon.special_on_crit and weapon.special_on_crit.fct and (not target.dead or weapon.special_on_crit.on_kill) then
weapon.special_on_crit.fct(weapon, self, target)
end
-- Special effect on crit AMMO!
if crit and ammo and ammo.special_on_crit and ammo.special_on_crit.fct and (not target.dead or ammo.special_on_crit.on_kill) then
ammo.special_on_crit.fct(ammo, self, target)
end
-- Special effect on kill
if hitted and weapon and weapon.special_on_kill and weapon.special_on_kill.fct and target.dead then
weapon.special_on_kill.fct(weapon, self, target)
end
-- Special effect on kill A-A-A-AMMMO!
if hitted and ammo and ammo.special_on_kill and ammo.special_on_kill.fct and target.dead then
ammo.special_on_kill.fct(ammo, self, target)
end
Code: Select all
-- Special effect
if hitted and weapon and weapon.special_on_hit then
local specials = weapon.special_on_hit
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct and (not target.dead or special.on_kill) then
special.fct(weapon, self, target, dam)
end
end
end
if hitted and crit and weapon and weapon.special_on_crit then
local specials = weapon.special_on_crit
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct and (not target.dead or special.on_kill) then
special.fct(weapon, self, target, dam)
end
end
end
if hitted and weapon and weapon.special_on_kill and target.dead then
local specials = weapon.special_on_kill
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct then
special.fct(weapon, self, target, dam)
end
end
end