Add fire charge support for dispenser

This commit is contained in:
Wuzzy 2017-02-15 01:38:47 +01:00
parent ec84f955cb
commit 2a0668a109
2 changed files with 15 additions and 2 deletions

@ -4,3 +4,4 @@ mcl_sounds
mcl_fire
mcl_tnt
mcl_heads
mobs_mc

@ -84,7 +84,7 @@ local dispenserdef = {
--[===[ Dispense item ]===]
if iname == "mcl_throwing:arrow" then
-- Shoot arrow
local shootpos = vector.add(droppos, vector.multiply(dropdir, -1))
local shootpos = vector.add(pos, vector.multiply(dropdir, 0.51))
local yaw = math.atan2(dropdir.z, dropdir.x) + math.pi/2
mcl_throwing.shoot_arrow(iname, shootpos, dropdir, yaw, nil)
@ -93,12 +93,24 @@ local dispenserdef = {
elseif iname == "mcl_throwing:egg" or iname == "mcl_throwing:snowball" then
-- Throw egg or snowball
local shootpos = vector.add(droppos, vector.multiply(dropdir, -1))
local shootpos = vector.add(pos, vector.multiply(dropdir, 0.51))
mcl_throwing.throw(iname, shootpos, dropdir)
stack:take_item()
inv:set_stack("main", stack_id, stack)
elseif iname == "mcl_fire:fire_charge" then
-- Throw fire charge
local shootpos = vector.add(pos, vector.multiply(dropdir, 0.51))
local fireball = minetest.add_entity(shootpos, "mobs_mc:blaze_fireball")
local ent = fireball:get_luaentity()
local v = ent.velocity or 1
fireball:setvelocity(vector.multiply(dropdir, v))
ent.switch = 1
stack:take_item()
inv:set_stack("main", stack_id, stack)
elseif iname == "mcl_fire:flint_and_steel" then
-- Ignite air or fire
if dropnode.name == "air" then