mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-08-19 21:44:12 +02:00
Add snowball and egg to dispenser support
parent
a9f2c705da
commit
e672abd2ed
@ -24,7 +24,7 @@ mcl_throwing.throw = function(throw_item, pos, dir, velocity)
|
||||
velocity = 22
|
||||
end
|
||||
|
||||
local itemstring = throw_item:get_name()
|
||||
local itemstring = ItemStack(throw_item):get_name()
|
||||
local obj = minetest.add_entity(pos, entity_mapping[itemstring])
|
||||
obj:setvelocity({x=dir.x*velocity, y=dir.y*velocity, z=dir.z*velocity})
|
||||
obj:setacceleration({x=dir.x*-3, y=-GRAVITY, z=dir.z*-3})
|
||||
|
@ -92,6 +92,15 @@ local dispenserdef = {
|
||||
stack:take_item()
|
||||
inv:set_stack("main", stack_id, stack)
|
||||
|
||||
elseif iname == "mcl_throwing:egg" or iname == "mcl_throwing:snowball" then
|
||||
-- Throw egg or snowball
|
||||
local f = {x=dropdir.x, y=0, z=dropdir.z}
|
||||
local shootpos = vector.add(droppos, f)
|
||||
mcl_throwing.throw(iname, shootpos, dropdir)
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user