1
0
Fork 0

Fix direction issues of dispenser

This commit is contained in:
Wuzzy 2017-02-15 00:16:47 +01:00
parent a044bd9cc6
commit 7c3bf9715a
1 changed files with 3 additions and 5 deletions

View File

@ -52,7 +52,7 @@ local dispenserdef = {
local droppos, dropdir local droppos, dropdir
if node.name == "mcl_dispensers:dispenser" then if node.name == "mcl_dispensers:dispenser" then
dropdir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) dropdir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
droppos = vector.subtract(pos, dropdir) droppos = vector.add(pos, dropdir)
elseif node.name == "mcl_dispensers:dispenser_up" then elseif node.name == "mcl_dispensers:dispenser_up" then
dropdir = {x=0, y=1, z=0} dropdir = {x=0, y=1, z=0}
droppos = {x=pos.x, y=pos.y+1, z=pos.z} droppos = {x=pos.x, y=pos.y+1, z=pos.z}
@ -84,8 +84,7 @@ local dispenserdef = {
--[===[ Dispense item ]===] --[===[ Dispense item ]===]
if iname == "mcl_throwing:arrow" then if iname == "mcl_throwing:arrow" then
-- Shoot arrow -- Shoot arrow
local f = {x=dropdir.x, y=0, z=dropdir.z} local shootpos = vector.add(droppos, vector.multiply(dropdir, -1))
local shootpos = vector.add(droppos, f)
local yaw = math.atan2(dropdir.z, dropdir.x) + math.pi/2 local yaw = math.atan2(dropdir.z, dropdir.x) + math.pi/2
mcl_throwing.shoot_arrow(iname, shootpos, dropdir, yaw, nil) mcl_throwing.shoot_arrow(iname, shootpos, dropdir, yaw, nil)
@ -94,8 +93,7 @@ local dispenserdef = {
elseif iname == "mcl_throwing:egg" or iname == "mcl_throwing:snowball" then elseif iname == "mcl_throwing:egg" or iname == "mcl_throwing:snowball" then
-- Throw egg or snowball -- Throw egg or snowball
local f = {x=dropdir.x, y=0, z=dropdir.z} local shootpos = vector.add(droppos, vector.multiply(dropdir, -1))
local shootpos = vector.add(droppos, f)
mcl_throwing.throw(iname, shootpos, dropdir) mcl_throwing.throw(iname, shootpos, dropdir)
stack:take_item() stack:take_item()