forked from oerkki/voxelands
panting sound when player is low on energy
This commit is contained in:
parent
387057b3c6
commit
0081718a7c
Binary file not shown.
Binary file not shown.
|
@ -744,7 +744,8 @@ LocalPlayer::LocalPlayer():
|
|||
cold_effectf(0.0),
|
||||
m_sneak_node(32767,32767,32767),
|
||||
m_sneak_node_exists(false),
|
||||
m_can_use_energy(true)
|
||||
m_can_use_energy(true),
|
||||
m_low_energy_effect(0)
|
||||
{
|
||||
m_energy = 10.0;
|
||||
m_character = g_settings->get("character_definition");
|
||||
|
@ -1107,8 +1108,22 @@ void LocalPlayer::applyControl(float dtime)
|
|||
}else if (m_energy < -0.1) {
|
||||
m_can_use_energy = false;
|
||||
m_energy = -0.1;
|
||||
if (g_sound) {
|
||||
if (m_character == "")
|
||||
m_character = std::string(PLAYER_DEFAULT_CHARDEF);
|
||||
Strfnd f(m_character);
|
||||
std::string gender = f.next(":");
|
||||
std::string snd("low-energy-");
|
||||
snd += gender;
|
||||
|
||||
m_low_energy_effect = g_sound->playSound(snd,true);
|
||||
}
|
||||
}else if (m_energy > 1.8) {
|
||||
m_can_use_energy = true;
|
||||
if (g_sound && m_low_energy_effect) {
|
||||
g_sound->stopSound(m_low_energy_effect);
|
||||
m_low_energy_effect = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (energy_effectf > 0.0)
|
||||
|
|
|
@ -540,6 +540,7 @@ private:
|
|||
content_t m_old_node_below_type;
|
||||
float m_energy;
|
||||
bool m_can_use_energy;
|
||||
int m_low_energy_effect;
|
||||
|
||||
};
|
||||
#endif // !SERVER
|
||||
|
|
|
@ -120,6 +120,8 @@ void init_sounds(ISoundManager *sound)
|
|||
|
||||
// special
|
||||
sound->loadSound("wield","wield_item.ogg");
|
||||
sound->loadSound("low-energy-F","low_energy_F.ogg");
|
||||
sound->loadSound("low-energy-M","low_energy_M.ogg");
|
||||
|
||||
// menu backgrounds
|
||||
sound->loadSound("bg-mainmenu","bg_mainmenu.ogg");
|
||||
|
|
Loading…
Reference in New Issue