mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-08-18 21:14:11 +02:00
Add throwing sound
This commit is contained in:
parent
e49e75ece2
commit
5bd3ebda17
@ -108,6 +108,7 @@ function mcl_potions.register_lingering(name, descr, color, def)
|
||||
local velocity = 10
|
||||
local dir = placer:get_look_dir();
|
||||
local pos = placer:getpos();
|
||||
minetest.sound_play("mcl_throwing_throw", {pos = pos, gain = 0.4, max_hear_distance = 16}, true)
|
||||
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
|
||||
obj:setvelocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
|
||||
obj:setacceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3})
|
||||
@ -120,7 +121,9 @@ function mcl_potions.register_lingering(name, descr, color, def)
|
||||
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 pos = {x=s_pos.x+dropdir.x,y=s_pos.y+dropdir.y,z=s_pos.z+dropdir.z}
|
||||
minetest.sound_play("mcl_throwing_throw", {pos = pos, gain = 0.4, max_hear_distance = 16}, true)
|
||||
local obj = minetest.add_entity(pos, 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})
|
||||
|
@ -30,6 +30,7 @@ function mcl_potions.register_splash(name, descr, color, def)
|
||||
local velocity = 10
|
||||
local dir = placer:get_look_dir();
|
||||
local pos = placer:get_pos();
|
||||
minetest.sound_play("mcl_throwing_throw", {pos = pos, gain = 0.4, max_hear_distance = 16}, true)
|
||||
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=dir.x*-3, y=-9.8, z=dir.z*-3})
|
||||
@ -42,7 +43,9 @@ function mcl_potions.register_splash(name, descr, color, def)
|
||||
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 pos = {x=s_pos.x+dropdir.x,y=s_pos.y+dropdir.y,z=s_pos.z+dropdir.z}
|
||||
minetest.sound_play("mcl_throwing_throw", {pos = pos, gain = 0.4, max_hear_distance = 16}, true)
|
||||
local obj = minetest.add_entity(pos, 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})
|
||||
|
@ -23,4 +23,10 @@ It's a MineClone 2 mod containing throwable items like snowballs.
|
||||
- Author: dav0r (freesound.org)
|
||||
- Source: <https://freesound.org/people/dav0r/sounds/176760/>
|
||||
- Original title: `d0_step_on_egg_04` (file was edited)
|
||||
- `mcl_throwing_throw.ogg`:
|
||||
- License: CC0
|
||||
- Author: kretopi (freesound.org)
|
||||
- Source: <https://freesound.org/people/kretopi/sounds/406405/>
|
||||
- Original title: `Arrow002.wav` (file was edited)
|
||||
|
||||
- Everything else: See MineClone 2 license infos
|
||||
|
@ -31,6 +31,7 @@ mcl_throwing.throw = function(throw_item, pos, dir, velocity, thrower)
|
||||
if velocity == nil then
|
||||
velocity = 22
|
||||
end
|
||||
minetest.sound_play("mcl_throwing_throw", {pos=pos, gain=0.4, max_hear_distance=16}, true)
|
||||
|
||||
local itemstring = ItemStack(throw_item):get_name()
|
||||
local obj = minetest.add_entity(pos, entity_mapping[itemstring])
|
||||
|
BIN
mods/ITEMS/mcl_throwing/sounds/mcl_throwing_throw.ogg
Normal file
BIN
mods/ITEMS/mcl_throwing/sounds/mcl_throwing_throw.ogg
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user