Add snowball and egg impact sounds

This commit is contained in:
Wuzzy 2019-12-09 11:52:19 +01:00
parent 9e31c2b62b
commit 1c7e350095
5 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,26 @@
# `mcl_throwing`
It's a MineClone 2 mod containing throwable items like snowballs.
## License of code
- MIT License
## License of media
- `mcl_throwing_snowball_impact_soft.ogg`:
- License: CC BY 3.0 <http://creativecommons.org/licenses/by/3.0/>
- Author: YleArkisto (freesound.org)
- Source: <https://freesound.org/people/YleArkisto/sounds/258144/>
- Original title: `sfx_snowball_hit-03.wav` (file was edited)
- `mcl_throwing_snowball_impact_hard.ogg`:
- License: CC0
- Author: Julien Matthey (freesound.org)
- Source: <https://freesound.org/people/Julien%20Matthey/sounds/167080/>
- Original title: `JM_IMPACT_01c - Snow on cement.wav` (file was edited)
- `mcl_throwing_egg_impact.ogg`:
- License: CC0
- Author: dav0r (freesound.org)
- Source: <https://freesound.org/people/dav0r/sounds/176760/>
- Original title: `d0_step_on_egg_04` (file was edited)
- Everything else: See MineClone 2 license infos

View file

@ -187,6 +187,7 @@ local snowball_on_step = function(self, dtime)
-- Destroy when hitting a solid node -- Destroy when hitting a solid node
if self._lastpos.x~=nil then if self._lastpos.x~=nil then
if (def and def.walkable) or not def then if (def and def.walkable) or not def then
minetest.sound_play("mcl_throwing_snowball_impact_hard", { pos = self.object:get_pos(), max_hear_distance=16, gain=0.7 })
self.object:remove() self.object:remove()
return return
end end
@ -201,6 +202,7 @@ local snowball_on_step = function(self, dtime)
end end
if check_object_hit(self, pos, mob_damage) then if check_object_hit(self, pos, mob_damage) then
minetest.sound_play("mcl_throwing_snowball_impact_soft", { pos = self.object:get_pos(), max_hear_distance=16, gain=0.7 })
return return
end end
@ -254,6 +256,7 @@ local egg_on_step = function(self, dtime)
end end
end end
end end
minetest.sound_play("mcl_throwing_egg_impact", { pos = self.object:get_pos(), max_hear_distance=10, gain=0.5 })
self.object:remove() self.object:remove()
return return
end end
@ -261,6 +264,7 @@ local egg_on_step = function(self, dtime)
-- Destroy when hitting a mob or player (no chick spawning) -- Destroy when hitting a mob or player (no chick spawning)
if check_object_hit(self, pos) then if check_object_hit(self, pos) then
minetest.sound_play("mcl_throwing_egg_impact", { pos = self.object:get_pos(), max_hear_distance=10, gain=0.5 })
return return
end end