Add Punch sound (work with Objects (and mobs!) and Players)
parent
e3d3d75374
commit
1b63b277d0
|
@ -111,6 +111,12 @@ wool_coat_movement.ogg from freeSFX.co.uk and has a Creative Commons license
|
|||
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
|
||||
----------
|
||||
paramat (CC BY-SA 3.0):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue