Fix arrow yaw when shooting from dispenser

This commit is contained in:
Wuzzy 2017-02-14 22:28:40 +01:00
parent feca7cf694
commit 1bf5c51d37

View File

@ -84,9 +84,10 @@ local dispenserdef = {
--[===[ Dispense item ]===]
if iname == "mcl_throwing:arrow" then
-- Shoot arrow
local shootpos = vector.add(droppos, dropdir)
-- FIXME: Bad yaw of arrow when shootin
mcl_throwing.shoot_arrow(iname, shootpos, dropdir, 0, nil)
local f = {x=dropdir.x, y=0, z=dropdir.z}
local shootpos = vector.add(droppos, f)
local yaw = math.atan2(dropdir.z, dropdir.x) + math.pi/2
mcl_throwing.shoot_arrow(iname, shootpos, dropdir, yaw, nil)
stack:take_item()
inv:set_stack("main", stack_id, stack)