Add fire charge support for dispenser
This commit is contained in:
parent
ec84f955cb
commit
2a0668a109
|
@ -4,3 +4,4 @@ mcl_sounds
|
||||||
mcl_fire
|
mcl_fire
|
||||||
mcl_tnt
|
mcl_tnt
|
||||||
mcl_heads
|
mcl_heads
|
||||||
|
mobs_mc
|
||||||
|
|
|
@ -84,7 +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 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
|
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)
|
||||||
|
|
||||||
|
@ -93,12 +93,24 @@ 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 shootpos = vector.add(droppos, vector.multiply(dropdir, -1))
|
local shootpos = vector.add(pos, vector.multiply(dropdir, 0.51))
|
||||||
mcl_throwing.throw(iname, shootpos, dropdir)
|
mcl_throwing.throw(iname, shootpos, dropdir)
|
||||||
|
|
||||||
stack:take_item()
|
stack:take_item()
|
||||||
inv:set_stack("main", stack_id, stack)
|
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
|
elseif iname == "mcl_fire:flint_and_steel" then
|
||||||
-- Ignite air or fire
|
-- Ignite air or fire
|
||||||
if dropnode.name == "air" then
|
if dropnode.name == "air" then
|
||||||
|
|
Loading…
Reference in New Issue