mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2025-02-17 21:23:44 +01:00
Add a get_arrow_hit_func function to mcl_mobs
reason for this is that player:punch used by most mobs ignores armor worn by player
This commit is contained in:
@ -334,6 +334,13 @@ function mcl_mobs.register_mob(name, def)
|
|||||||
end -- END mcl_mobs.register_mob function
|
end -- END mcl_mobs.register_mob function
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_mobs.get_arrow_damage_func(damage, typ)
|
||||||
|
local typ = mcl_damage.types[typ] and typ or "arrow"
|
||||||
|
return function(projectile, object)
|
||||||
|
return mcl_util.deal_damage(object, damage, {type = typ})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- register arrow for shoot attack
|
-- register arrow for shoot attack
|
||||||
function mcl_mobs.register_arrow(name, def)
|
function mcl_mobs.register_arrow(name, def)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user