summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-19 03:10:42 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-19 13:17:00 +0300
commit4464ef501c562cf6eeda3b59b1dfcf21d9dfb5a9 (patch)
tree1eab9247b1b58d448d64e25f6906447dfba53bd4 /src/being.cpp
parent2a09c2afe8bd1f476ef1901c9c639896534a081c (diff)
downloadmanaverse-4464ef501c562cf6eeda3b59b1dfcf21d9dfb5a9.tar.gz
manaverse-4464ef501c562cf6eeda3b59b1dfcf21d9dfb5a9.tar.bz2
manaverse-4464ef501c562cf6eeda3b59b1dfcf21d9dfb5a9.tar.xz
manaverse-4464ef501c562cf6eeda3b59b1dfcf21d9dfb5a9.zip
Add support for away particle effect.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 29ffefcfd..aad803ba2 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -188,6 +188,7 @@ bool Being::mShowLevel = false;
bool Being::mShowPlayersStatus = false;
bool Being::mEnableReorderSprites = true;
bool Being::mHideErased = false;
+int Being::mAwayEffect = -1;
std::list<BeingCacheEntry*> beingInfoCache;
typedef std::map<int, Guild*>::const_iterator GuildsMapCIter;
@@ -245,7 +246,8 @@ Being::Being(const int id, const Type type, const uint16_t subtype,
mAway(false),
mInactive(false),
mNumber(100),
- mHairColor(0)
+ mHairColor(0),
+ mAfkParticle(nullptr)
{
for (int f = 0; f < 20; f ++)
@@ -1899,6 +1901,7 @@ void Being::reReadConfig()
BLOCK_START("Being::reReadConfig")
if (mUpdateConfigTime + 1 < cur_time)
{
+ mAwayEffect = paths.getIntValue("afkEffectId");
mHighlightMapPortals = config.getBoolValue("highlightMapPortals");
mConfLineLim = config.getIntValue("chatMaxCharLimit");
mSpeechType = config.getIntValue("speech");
@@ -1951,6 +1954,7 @@ bool Being::updateFromCache()
mInactive = false;
}
+ updateAwayEffect();
if (mType == PLAYER)
updateColors();
return true;
@@ -2678,6 +2682,7 @@ void Being::setState(const uint8_t state)
mShop = shop;
mAway = away;
mInactive = inactive;
+ updateAwayEffect();
if (needUpdate)
{
@@ -2753,6 +2758,26 @@ int Being::getSpriteID(const int slot) const
return mSpriteIDs[slot];
}
+void Being::addAfkEffect()
+{
+ if (effectManager && !mAfkParticle && mAwayEffect != -1)
+ mAfkParticle = effectManager->triggerReturn(mAwayEffect, this);
+}
+
+void Being::removeAfkEffect()
+{
+ if (effectManager && mAfkParticle)
+ mChildParticleEffects.removeLocally(mAfkParticle);
+}
+
+void Being::updateAwayEffect()
+{
+ if (mAway)
+ addAfkEffect();
+ else
+ removeAfkEffect();
+}
+
BeingEquipBackend::BeingEquipBackend(Being *const being):
mBeing(being)
{