2012-06-14 13:06:06 +00:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2012-09-23 22:09:57 +00:00
|
|
|
#include "Pawn.h"
|
2012-06-14 13:06:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-01 10:39:56 +00:00
|
|
|
cPawn::cPawn(eEntityType a_EntityType, double a_Width, double a_Height)
|
|
|
|
: cEntity(a_EntityType, 0, 0, 0, a_Width, a_Height)
|
2014-06-06 07:17:49 +00:00
|
|
|
, m_EntityEffects(std::map<cEntityEffect::eType, cEntityEffect>())
|
2012-06-14 13:06:06 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-06 07:17:49 +00:00
|
|
|
void cPawn::Tick(float a_Dt, cChunk & a_Chunk)
|
|
|
|
{
|
2014-06-07 03:02:39 +00:00
|
|
|
// Iterate through this entity's applied effects
|
|
|
|
for (std::map<cEntityEffect::eType, cEntityEffect>::iterator iter = m_EntityEffects.begin();
|
|
|
|
iter != m_EntityEffects.end();
|
|
|
|
++iter)
|
|
|
|
{
|
|
|
|
// Reduce the effect's duration
|
|
|
|
iter->second.m_Ticks--;
|
|
|
|
|
|
|
|
// Remove effect if duration has elapsed
|
|
|
|
if (iter->second.m_Ticks <= 0)
|
|
|
|
{
|
|
|
|
RemoveEntityEffect(iter->first);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Check for discrepancies between client and server effect values
|
|
|
|
}
|
2014-06-06 07:17:49 +00:00
|
|
|
|
|
|
|
super::Tick(a_Dt, a_Chunk);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
|
|
|
|
{
|
|
|
|
m_EntityEffects[a_EffectType] = a_Effect;
|
2014-06-07 03:02:39 +00:00
|
|
|
//m_World->BroadcastEntityEffect(*this, a_EffectType, a_Effect.m_Intensity, a_Effect.m_Ticks);
|
2014-06-06 07:17:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cPawn::RemoveEntityEffect(cEntityEffect::eType a_EffectType)
|
|
|
|
{
|
|
|
|
m_EntityEffects.erase(a_EffectType);
|
2014-06-07 03:02:39 +00:00
|
|
|
//m_World->BroadcastRemoveEntityEffect(*this, a_EffectType);
|
2014-06-06 07:17:49 +00:00
|
|
|
}
|