1
0
Fork 0

Play sound when hitting other player with arrow

This commit is contained in:
Wuzzy 2018-05-07 22:23:15 +02:00
parent 254a12b8af
commit e55a1a6211
3 changed files with 18 additions and 8 deletions

View File

@ -1,10 +1,13 @@
This mod adds bows, arrows and throwable items for MineClone 2.
License:
Source code: LGPL 3.0
Textures: See MineClone 2 license notes.
Everything else: MIT License
Incorporates code from the [bow] mod by Arcelmi.
https://github.com/Arcelmi/minetest-bows
* Source code: LGPL 3.0
* Incorporates code from the [bow] mod by Arcelmi.
https://github.com/Arcelmi/minetest-bows
* Textures: See MineClone 2 license notes.
* Sounds:
* mcl_throwing_bow_shoot.ogg: MIT License
* mcl_throwing_hit_player.ogg: CC BY 3.0 by Freesound.org user tim.kahn.
https://freesound.org/people/tim.kahn/sounds/38495/
http://creativecommons.org/licenses/by/3.0/

View File

@ -100,9 +100,16 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
full_punch_interval=1.0,
damage_groups={fleshy=self._damage},
}, nil)
if mod_mcl_hunger and is_player then
if is_player then
if self._shooter and self._shooter:is_player() then
-- “Ding” sound for hitting another player
minetest.sound_play({name="mcl_throwing_hit_player", gain=0.1}, {to_player=self._shooter})
end
if mod_mcl_hunger then
mcl_hunger.exhaust(obj:get_player_name(), mcl_hunger.EXHAUST_DAMAGE)
end
end
if lua then
local entity_name = lua.name