From 64046d2c5fde6100242d69edcf3547aed3824dcd Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 11 Jul 2020 09:07:27 -0400 Subject: [PATCH] update for dispenser compatibility --- mods/ITEMS/mcl_potions/lingering.lua | 9 ++++++++- mods/ITEMS/mcl_potions/splash.lua | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_potions/lingering.lua b/mods/ITEMS/mcl_potions/lingering.lua index a336201aea..f62a939053 100644 --- a/mods/ITEMS/mcl_potions/lingering.lua +++ b/mods/ITEMS/mcl_potions/lingering.lua @@ -87,6 +87,13 @@ local function register_lingering(name, descr, color, def) return item end, stack_max = 1, + _on_dispense = function(stack, dispenserpos, droppos, dropnode, dropdir) + local s_pos = vector.add(dispenserpos, vector.multiply(dropdir, 0.51)) + local obj = minetest.add_entity({x=s_pos.x+dropdir.x,y=s_pos.y+dropdir.y,z=s_pos.z+dropdir.z}, id.."_flying") + local velocity = 22 + obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity}) + obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3}) + end }) local w = 0.7 @@ -294,7 +301,7 @@ register_lingering("fire_resistance_plus", S("Lingering Fire Resistance Potion + -- -- TODO: Fix tooltip -- tt = time_string(mcl_potions.DURATION_2*0.25) -- }) --- +-- -- register_lingering("strength_plus", S("Lingering Strength Potion +"), "#D444E4", { -- potion_fun = function(player) mcl_potions.strength_func(player, 3, mcl_potions.DURATION_PLUS*0.25) end, -- -- TODO: Fix tooltip diff --git a/mods/ITEMS/mcl_potions/splash.lua b/mods/ITEMS/mcl_potions/splash.lua index 6de5e07adf..d85997c3d6 100644 --- a/mods/ITEMS/mcl_potions/splash.lua +++ b/mods/ITEMS/mcl_potions/splash.lua @@ -22,13 +22,20 @@ local function register_splash(name, descr, color, def) local pos = placer:get_pos(); local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying") obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity}) - obj:set_acceleration({x=0, y=-9.8, z=0}) + obj:set_acceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3}) if not minetest.is_creative_enabled(placer:get_player_name()) then item:take_item() end return item end, - stack_max = 1, + stack_max = 1, + _on_dispense = function(stack, dispenserpos, droppos, dropnode, dropdir) + local s_pos = vector.add(dispenserpos, vector.multiply(dropdir, 0.51)) + local obj = minetest.add_entity({x=s_pos.x+dropdir.x,y=s_pos.y+dropdir.y,z=s_pos.z+dropdir.z}, id.."_flying") + local velocity = 22 + obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity}) + obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3}) + end }) local w = 0.7