1
0
Fork 0

Added sounds to levers and mobs

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1093 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
luksor111@gmail.com 2012-12-21 18:05:34 +00:00
parent afaf104b40
commit 994b02f5af
23 changed files with 57 additions and 1 deletions

View File

@ -40,7 +40,16 @@ void cBlockLeverHandler::OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY
void cBlockLeverHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
//Flip the ON bit on/off. Using XOR bitwise operation to turn it on/off.
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, ((a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08) & 0x0f));
NIBBLETYPE Meta = ((a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08) & 0x0f);
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta);
if(Meta & 0x08)
{
a_World->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, 0.6f);
}
else
{
a_World->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, 0.5f);
}
}

View File

@ -10,6 +10,8 @@
cBat::cBat(void)
{
m_MobType = 65;
m_SoundHurt = "mob.bat.hurt";
m_SoundDeath = "mob.bat.death";
GetMonsterConfig("Bat");
}

View File

@ -10,6 +10,8 @@
cBlaze::cBlaze(void)
{
m_MobType = 61;
m_SoundHurt = "mob.blaze.hit";
m_SoundDeath = "mob.blaze.death";
GetMonsterConfig("Blaze");
}

View File

@ -10,6 +10,8 @@
cCavespider::cCavespider(void)
{
m_MobType = 59;
m_SoundHurt = "mob.spider.say";
m_SoundDeath = "mob.spider.death";
GetMonsterConfig("Cavespider");
}

View File

@ -16,6 +16,8 @@
cChicken::cChicken(void)
{
m_MobType = 93;
m_SoundHurt = "mob.chicken.hurt";
m_SoundDeath = "mob.chicken.hurt";
GetMonsterConfig("Chicken");
}

View File

@ -16,6 +16,8 @@
cCow::cCow(void)
{
m_MobType = 92;
m_SoundHurt = "mob.cow.hurt";
m_SoundDeath = "mob.cow.hurt";
GetMonsterConfig("Cow");
}

View File

@ -10,6 +10,8 @@
cCreeper::cCreeper(void)
{
m_MobType = 50;
m_SoundHurt = "mob.creeper.say";
m_SoundDeath = "mob.creeper.say";
GetMonsterConfig("Creeper");
}

View File

@ -10,6 +10,8 @@
cEnderman::cEnderman(void)
{
m_MobType = 58;
m_SoundHurt = "mob.endermen.hit";
m_SoundDeath = "mob.endermen.death";
GetMonsterConfig("Enderman");
}

View File

@ -10,6 +10,8 @@
cGhast::cGhast(void)
{
m_MobType = 56;
m_SoundHurt = "mob.ghast.scream";
m_SoundDeath = "mob.ghast.death";
GetMonsterConfig("Ghast");
}

View File

@ -10,6 +10,8 @@
cMagmacube::cMagmacube()
{
m_MobType = 62;
m_SoundHurt = "mob.magmacube.big";
m_SoundDeath = "mob.magmacube.big";
GetMonsterConfig("Magmacube");
}

View File

@ -38,6 +38,8 @@ cMonster::cMonster(void)
, m_DestroyTimer( 0 )
, m_Jump(0)
, m_MobType( 0 )
, m_SoundHurt( "" )
, m_SoundDeath( "" )
, m_EMState(IDLE)
, m_SightDistance(25)
, m_SeePlayerInterval (0)
@ -303,6 +305,7 @@ void cMonster::HandlePhysics(float a_Dt)
void cMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
{
super::DoTakeDamage(a_TDI);
if((m_SoundHurt != "") && (m_Health > 0)) m_World->BroadcastSoundEffect(m_SoundHurt, (int)(m_Pos.x * 8), (int)(m_Pos.y * 8), (int)(m_Pos.z * 8), 1.0f, 0.8f);
if (a_TDI.Attacker != NULL)
{
m_Target = a_TDI.Attacker;
@ -317,6 +320,7 @@ void cMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
void cMonster::KilledBy(cPawn * a_Killer)
{
super::KilledBy(a_Killer);
if(m_SoundHurt != "") m_World->BroadcastSoundEffect(m_SoundDeath, (int)(m_Pos.x * 8), (int)(m_Pos.y * 8), (int)(m_Pos.z * 8), 1.0f, 0.8f);
m_DestroyTimer = 0;
}

View File

@ -92,6 +92,9 @@ protected:
char m_MobType;
AString m_SoundHurt;
AString m_SoundDeath;
float m_SeePlayerInterval;
float m_AttackDamage;
float m_AttackRange;

View File

@ -16,6 +16,8 @@
cMooshroom::cMooshroom(void)
{
m_MobType = 96;
m_SoundHurt = "mob.cow.hurt";
m_SoundDeath = "mob.cow.hurt";
GetMonsterConfig("Mooshroom");
}

View File

@ -10,6 +10,8 @@
cOcelot::cOcelot()
{
m_MobType = 98;
m_SoundHurt = "mob.cat.hitt";
m_SoundDeath = "mob.cat.hitt";
GetMonsterConfig("Ocelot");
}

View File

@ -10,6 +10,8 @@
cPig::cPig(void)
{
m_MobType = 90;
m_SoundHurt = "mob.pig.say";
m_SoundDeath = "mob.pig.death";
GetMonsterConfig("Pig");
}

View File

@ -13,6 +13,8 @@ cSheep::cSheep(void) :
m_WoolColor(E_META_WOOL_WHITE)
{
m_MobType = 91;
m_SoundHurt = "mob.sheep.say";
m_SoundDeath = "mob.sheep.say";
GetMonsterConfig("Sheep");
}

View File

@ -10,6 +10,8 @@
cSilverfish::cSilverfish(void)
{
m_MobType = 60;
m_SoundHurt = "mob.silverfish.hit";
m_SoundDeath = "mob.silverfish.kill";
GetMonsterConfig("Silverfish");
}

View File

@ -10,6 +10,8 @@
cSkeleton::cSkeleton(void)
{
m_MobType = 51;
m_SoundHurt = "mob.skeleton.hurt";
m_SoundDeath = "mob.skeleton.death";
GetMonsterConfig("Skeleton");
}

View File

@ -12,6 +12,8 @@
cSlime::cSlime(void)
{
m_MobType = 55;
m_SoundHurt = "mob.slime.attack";
m_SoundDeath = "mob.slime.attack";
GetMonsterConfig("Slime");
}

View File

@ -10,6 +10,8 @@
cSpider::cSpider()
{
m_MobType = 52;
m_SoundHurt = "mob.spider.say";
m_SoundDeath = "mob.spider.death";
GetMonsterConfig("Spider");
}

View File

@ -10,6 +10,8 @@
cWolf::cWolf(void)
{
m_MobType = 95;
m_SoundHurt = "mob.wolf.hurt";
m_SoundDeath = "mob.wolf.death";
GetMonsterConfig("Wolf");
}

View File

@ -10,6 +10,8 @@
cZombie::cZombie()
{
m_MobType = 54;
m_SoundHurt = "mob.zombie.hurt";
m_SoundDeath = "mob.zombie.death";
GetMonsterConfig("Zombie");
}

View File

@ -10,6 +10,8 @@
cZombiepigman::cZombiepigman()
{
m_MobType = 57;
m_SoundHurt = "mob.zombiepig.zpighurt";
m_SoundDeath = "mob.zombiepig.zpigdeath";
GetMonsterConfig("Zombiepigman");
}