From 2a0668a10953a96ee6c790dd3e2995dd0f971cf9 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 15 Feb 2017 01:38:47 +0100 Subject: [PATCH] Add fire charge support for dispenser --- mods/redstone/mcl_dispensers/depends.txt | 1 + mods/redstone/mcl_dispensers/init.lua | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mods/redstone/mcl_dispensers/depends.txt b/mods/redstone/mcl_dispensers/depends.txt index dbeb78ea8c..d9bd99d8db 100644 --- a/mods/redstone/mcl_dispensers/depends.txt +++ b/mods/redstone/mcl_dispensers/depends.txt @@ -4,3 +4,4 @@ mcl_sounds mcl_fire mcl_tnt mcl_heads +mobs_mc diff --git a/mods/redstone/mcl_dispensers/init.lua b/mods/redstone/mcl_dispensers/init.lua index 8d76e5f36c..d8f7f6c6e2 100644 --- a/mods/redstone/mcl_dispensers/init.lua +++ b/mods/redstone/mcl_dispensers/init.lua @@ -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