diff options
author | archshift <admin@archshift.com> | 2014-06-07 05:02:39 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-06-17 20:17:33 +0200 |
commit | 90145a95144a7895fe9a2d7bb1d5c7a192f3a0ad (patch) | |
tree | 0b1f2ff48f977abe50c7189cdfbf2a561a231316 /src/Entities/Pawn.cpp | |
parent | cPawn: Remove unused m_bBurnable (diff) | |
download | cuberite-90145a95144a7895fe9a2d7bb1d5c7a192f3a0ad.tar cuberite-90145a95144a7895fe9a2d7bb1d5c7a192f3a0ad.tar.gz cuberite-90145a95144a7895fe9a2d7bb1d5c7a192f3a0ad.tar.bz2 cuberite-90145a95144a7895fe9a2d7bb1d5c7a192f3a0ad.tar.lz cuberite-90145a95144a7895fe9a2d7bb1d5c7a192f3a0ad.tar.xz cuberite-90145a95144a7895fe9a2d7bb1d5c7a192f3a0ad.tar.zst cuberite-90145a95144a7895fe9a2d7bb1d5c7a192f3a0ad.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Pawn.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp index 13934d943..95d1b113e 100644 --- a/src/Entities/Pawn.cpp +++ b/src/Entities/Pawn.cpp @@ -19,7 +19,22 @@ cPawn::cPawn(eEntityType a_EntityType, double a_Width, double a_Height) void cPawn::Tick(float a_Dt, cChunk & a_Chunk) { - + // 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 + } super::Tick(a_Dt, a_Chunk); } @@ -31,6 +46,7 @@ void cPawn::Tick(float a_Dt, cChunk & a_Chunk) void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect) { m_EntityEffects[a_EffectType] = a_Effect; + //m_World->BroadcastEntityEffect(*this, a_EffectType, a_Effect.m_Intensity, a_Effect.m_Ticks); } @@ -40,4 +56,5 @@ void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_E void cPawn::RemoveEntityEffect(cEntityEffect::eType a_EffectType) { m_EntityEffects.erase(a_EffectType); + //m_World->BroadcastRemoveEntityEffect(*this, a_EffectType); } |