- Fixed Bug #99 -> Mobs no longer bother you in creative mode
- refactored many things in the Monster system git-svn-id: http://mc-server.googlecode.com/svn/trunk@112 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
37
source/cPassiveMonster.cpp
Normal file
37
source/cPassiveMonster.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "cPassiveMonster.h"
|
||||
|
||||
|
||||
cPassiveMonster::cPassiveMonster()
|
||||
{
|
||||
m_EMPersonality = PASSIVE;
|
||||
}
|
||||
|
||||
cPassiveMonster::~cPassiveMonster()
|
||||
{
|
||||
}
|
||||
|
||||
void cPassiveMonster::TakeDamage(int a_Damage, cEntity* a_Instigator)
|
||||
{
|
||||
cMonster::TakeDamage(a_Damage, a_Instigator);
|
||||
m_EMState = ESCAPING;
|
||||
}
|
||||
|
||||
void cPassiveMonster::Tick(float a_Dt)
|
||||
{
|
||||
cMonster::Tick(a_Dt);
|
||||
|
||||
m_SeePlayerInterval += a_Dt;
|
||||
|
||||
if(m_SeePlayerInterval > 1)
|
||||
{
|
||||
int rem = rand() % 3 + 1; //check most of the time but miss occasionally
|
||||
|
||||
m_SeePlayerInterval = 0.0;
|
||||
if(rem >= 2) {
|
||||
if(m_EMState == ESCAPING)
|
||||
{
|
||||
CheckEventLostPlayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user