Add Punch sound (work with Objects (and mobs!) and Players)

master
MoNTE48 2019-06-03 23:55:08 +02:00
parent e3d3d75374
commit 1b63b277d0
6 changed files with 17 additions and 7 deletions

View File

@ -110,6 +110,12 @@ wool_coat_movement.ogg from freeSFX.co.uk and has a Creative Commons license
http://www.freesound.org/people/thecheeseman/sounds/44428/
http://www.freesound.org/people/thecheeseman/sounds/44429/
http://www.freesound.org/people/thecheeseman/sounds/44430/
player_damage.1.ogg from TenPlus1 mobs_redo mod (Creative Commons sounds from Freesound.org)
sonictechtonic (CC BY 3.0):
https://www.freesound.org/people/sonictechtonic/sounds/241872/
player_damage.2.ogg
Schematics
----------

View File

@ -2704,7 +2704,7 @@ end
if damage >= 1 then
-- weapon sounds
if weapon_def.sounds then
--[[ if weapon_def.sounds then
local s = random(0, #weapon_def.sounds)
@ -2717,7 +2717,7 @@ if damage >= 1 then
object = self.object,
max_hear_distance = 5
})
end
end ]]
-- blood_particles
if not disable_blood and self.blood_amount > 0 then

View File

@ -15,7 +15,3 @@ Authors of media (textures, models and sounds)
stujones11 (CC BY-SA 3.0):
character.b3d
character.blend -- Both derived from a model by MirceaKitsune (CC BY-SA 3.0)
sonictechtonic (CC BY 3.0):
https://www.freesound.org/people/sonictechtonic/sounds/241872/
player_damage.ogg

View File

@ -545,6 +545,12 @@ public:
sm->m_sound->playSound(sm->m_ndef->get(nde->n).sound_dug, false);
}
static void objectPunch(MtEvent *e, void *data)
{
SoundMaker *sm = (SoundMaker *)data;
sm->m_sound->playSound(SimpleSoundSpec("player_punch", 1.0), false);
}
static void playerDamage(MtEvent *e, void *data)
{
SoundMaker *sm = (SoundMaker *)data;
@ -565,6 +571,7 @@ public:
mgr->reg("CameraPunchLeft", SoundMaker::cameraPunchLeft, this);
mgr->reg("CameraPunchRight", SoundMaker::cameraPunchRight, this);
mgr->reg("NodeDug", SoundMaker::nodeDug, this);
mgr->reg("ObjectPunch", SoundMaker::objectPunch, this);
mgr->reg("PlayerDamage", SoundMaker::playerDamage, this);
mgr->reg("PlayerFallingDamage", SoundMaker::playerFallingDamage, this);
}
@ -3972,6 +3979,7 @@ void Game::handlePointingAtObject(const PointedThing &pointed, const ItemStack &
}
if (do_punch_damage) {
client->event()->put(new SimpleTriggerEvent("ObjectPunch"));
// Report direct punch
v3f objpos = runData.selected_object->getPosition();
v3f dir = (objpos - player_position).normalize();
@ -4749,7 +4757,7 @@ void Game::showPauseMenu()
<< "bgcolor[#00000060;true]"
<< "button_exit[3.5," << (ypos++) << ";4,0.5;btn_continue;"
<< strgettext("Continue") << "]";
#if !defined(__ANDROID__) && !defined(__IOS__)
if (!simple_singleplayer_mode) {
os << "button_exit[3.5," << (ypos++) << ";4,0.5;btn_change_password;"