add miss sound for digging while pointing at air, add mob punch sound effect

This commit is contained in:
darkrose 2014-11-12 01:58:41 +10:00
parent 5480e0b404
commit b2cec53aa7
5 changed files with 18 additions and 2 deletions

BIN
data/sounds/dig_miss.ogg Normal file

Binary file not shown.

BIN
data/sounds/dig_mob.ogg Normal file

Binary file not shown.

View File

@ -2334,8 +2334,12 @@ void Client::playDigSound(content_t c)
volume /= 100.0;
if (c == CONTENT_IGNORE) {
c = getPointedContent();
if ((c&CONTENT_MOB_MASK) != 0)
printf("dig: %X\n",c);
if ((c&CONTENT_MOB_MASK) != 0) {
if (content_mob_features(c).sound_punch != "")
m_sound->playSound(content_mob_features(c).sound_punch,false,volume);
return;
}
}
switch (content_features(c).type) {
case CMT_PLANT:
@ -2353,7 +2357,8 @@ void Client::playDigSound(content_t c)
case CMT_WOOD:
m_sound->playSound("wood-dig",false,volume);
break;
default:;
default:
m_sound->playSound("miss-dig",false,volume);
}
}

View File

@ -124,6 +124,10 @@ struct MobFeatures {
f32 lifetime;
u16 contact_explosion_diameter;
std::string sound_death;
std::string sound_attack;
std::string sound_punch;
content_t spawn_on;
content_t spawn_in;
u8 spawn_min_light;
@ -239,6 +243,9 @@ struct MobFeatures {
special_dropped_max = 0;
lifetime = 0.0;
contact_explosion_diameter = 0;
sound_death = "";
sound_attack = "";
sound_punch = "mob-dig";
spawn_on = CONTENT_IGNORE;
spawn_in = CONTENT_IGNORE;
spawn_min_light = 0;

View File

@ -62,6 +62,10 @@ void init_sounds(ISoundManager *sound)
sound->loadSound("liquid-dig","dig_liquid.1.ogg");
// CMT_WOOD
sound->loadSound("wood-dig","dig_wood.1.ogg");
// mobs
sound->loadSound("mob-dig","dig_mob.ogg");
// miss
sound->loadSound("miss-dig","dig_miss.ogg");
// placing
sound->loadSound("place","place_node.1.ogg");