some mob sounds

This commit is contained in:
darkrose 2015-04-22 23:56:48 +10:00
parent a9e4540572
commit f05c9722ca
9 changed files with 26 additions and 3 deletions

View File

@ -55,7 +55,7 @@ Copyright (c) 2013-2015 Lisa 'darkrose' Milne <lisa@ltmnet.com>
Forked from Minetest 0.3.x
Copyright (c) 2010-2011 Perttu Ahola <celeron55@gmail.com>
Textures and Models:
Textures, Sounds, and Models:
This does not apply to texture packs made by others.
@ -68,6 +68,7 @@ darkrose
sapier
Tom Peter
Telaron
juskiddink
With special thanks to http://www.opengameart.org/
DEVELOPMENT:

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -388,6 +388,7 @@ void content_mob_init()
f->dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_FUR)+" 2";
f->motion = MM_SEEKER;
f->motion_type = MMT_WALK;
f->sound_random = "mob-deer-env";
f->spawn_on = CONTENT_WILDGRASS_SHORT;
f->spawn_in = CONTENT_AIR;
f->spawn_min_height = -5;
@ -416,6 +417,7 @@ void content_mob_init()
f->motion = MM_WANDER;
f->motion_type = MMT_WALK;
f->angry_motion = MM_SEEKER;
f->sound_random = "mob-deer-env";
f->spawn_on = CONTENT_WILDGRASS_SHORT;
f->spawn_in = CONTENT_AIR;
f->spawn_min_height = -5;
@ -446,6 +448,7 @@ void content_mob_init()
f->dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_FUR)+" 2";
f->motion = MM_SEEKER;
f->motion_type = MMT_WALK;
f->sound_random = "mob-deer-env";
f->notices_player = true;
f->lifetime = 1800.0;
f->setCollisionBox(aabb3f(-0.7*BS, 0., -0.7*BS, 0.7*BS, 1.5*BS, 0.7*BS));
@ -530,6 +533,7 @@ void content_mob_init()
f->spawn_max_light = LIGHT_MAX/2;
f->spawn_max_nearby_mobs = 3;
f->sound_punch = "mob-wolf-hit";
f->sound_spawn = "mob-wolf-spawn";
f->notices_player = true;
f->attack_player_damage = 3;
f->attack_player_range = v3f(1,1,1);
@ -581,6 +585,7 @@ void content_mob_init()
f->special_dropped_max = 8;
f->motion = MM_SEEKER;
f->motion_type = MMT_WALK;
f->sound_random = "mob-sheep-env";
f->spawn_on = CONTENT_WILDGRASS_SHORT;
f->spawn_in = CONTENT_AIR;
f->spawn_min_height = 2;

View File

@ -138,6 +138,7 @@ struct MobFeatures {
std::string sound_death;
std::string sound_attack;
std::string sound_punch;
std::string sound_random;
content_t spawn_on;
content_t spawn_in;
@ -266,6 +267,7 @@ struct MobFeatures {
sound_death = "";
sound_attack = "";
sound_punch = "mob-dig";
sound_punch = "";
spawn_on = CONTENT_IGNORE;
spawn_in = CONTENT_IGNORE;
spawn_min_light = 0;

View File

@ -402,7 +402,8 @@ MobSAO::MobSAO(ServerEnvironment *env, u16 id, v3f pos, content_t type):
m_shoot_reload_timer(0),
m_shooting(false),
m_shooting_timer(0),
m_shoot_y(0)
m_shoot_y(0),
m_last_sound(0)
{
ServerActiveObject::registerType(getType(), create);
if ((type&CONTENT_MOB_MASK) == CONTENT_MOB_MASK) {
@ -431,7 +432,8 @@ MobSAO::MobSAO(ServerEnvironment *env, u16 id, v3f pos, v3f speed, content_t typ
m_shoot_reload_timer(0),
m_shooting(false),
m_shooting_timer(0),
m_shoot_y(0)
m_shoot_y(0),
m_last_sound(0)
{
ServerActiveObject::registerType(getType(), create);
if ((type&CONTENT_MOB_MASK) == CONTENT_MOB_MASK) {
@ -500,6 +502,7 @@ void MobSAO::step(float dtime, bool send_recommended)
float disturbing_player_dir = 0;
m_age += dtime;
m_last_sound += dtime;
/* die, but not in the middle of attacking someone */
if (m.lifetime > 0.0 && m_age >= m.lifetime && (!m.notices_player || m_disturbing_player == "")) {
@ -530,6 +533,14 @@ void MobSAO::step(float dtime, bool send_recommended)
}
}
if (m_last_sound > 30.0) {
m_last_sound -= 5.0;
if (m.sound_random != "" && myrand_range(0,10) == 0) {
m_env->addEnvEvent(ENV_EVENT_SOUND,m_base_position,m.sound_random);
m_last_sound -= 30.0;
}
}
if (m.special_dropped_max > 0 && m_special_count < m.special_dropped_max && myrand_range(0,50) == 0)
m_special_count++;

View File

@ -120,6 +120,7 @@ private:
bool m_shooting;
float m_shooting_timer;
float m_shoot_y;
float m_last_sound;
};
#endif

View File

@ -113,6 +113,9 @@ void init_sounds(ISoundManager *sound)
// mobs
sound->loadSound("mob-oerkki-spawn","mob_oerkki_spawn.ogg");
sound->loadSound("mob-wolf-hit","mob_wolf_hit.ogg");
sound->loadSound("mob-wolf-spawn","mob_wolf_spawn.ogg");
sound->loadSound("mob-sheep-env","mob_sheep_env.ogg");
sound->loadSound("mob-deer-env","mob_deer_env.ogg");
// special
sound->loadSound("wield","wield_item.ogg");