update for dispenser compatibility
This commit is contained in:
parent
555e122387
commit
64046d2c5f
|
@ -87,6 +87,13 @@ local function register_lingering(name, descr, color, def)
|
||||||
return item
|
return item
|
||||||
end,
|
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
|
local w = 0.7
|
||||||
|
@ -294,7 +301,7 @@ register_lingering("fire_resistance_plus", S("Lingering Fire Resistance Potion +
|
||||||
-- -- TODO: Fix tooltip
|
-- -- TODO: Fix tooltip
|
||||||
-- tt = time_string(mcl_potions.DURATION_2*0.25)
|
-- tt = time_string(mcl_potions.DURATION_2*0.25)
|
||||||
-- })
|
-- })
|
||||||
--
|
--
|
||||||
-- register_lingering("strength_plus", S("Lingering Strength Potion +"), "#D444E4", {
|
-- 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,
|
-- potion_fun = function(player) mcl_potions.strength_func(player, 3, mcl_potions.DURATION_PLUS*0.25) end,
|
||||||
-- -- TODO: Fix tooltip
|
-- -- TODO: Fix tooltip
|
||||||
|
|
|
@ -22,13 +22,20 @@ local function register_splash(name, descr, color, def)
|
||||||
local pos = placer:get_pos();
|
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")
|
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_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
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
return item
|
return item
|
||||||
end,
|
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
|
local w = 0.7
|
||||||
|
|
Loading…
Reference in New Issue
Block a user