1
0
Fork 0

update for dispenser compatibility

objects
Brandon 2020-07-11 09:07:27 -04:00
parent 555e122387
commit 64046d2c5f
2 changed files with 17 additions and 3 deletions

View File

@ -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

View File

@ -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,
_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