diff options
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/being.cpp | 9 | ||||
-rw-r--r-- | src/being/being.h | 7 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 289f49411..b5c317ac4 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -211,7 +211,8 @@ Being::Being(const int id, mShop(false), mAway(false), mInactive(false), - mNeedPosUpdate(true) + mNeedPosUpdate(true), + mPetAi(true) { for (int f = 0; f < 20; f ++) { @@ -1590,9 +1591,12 @@ void Being::petLogic() fixPetSpawnPos(dstX, dstY); setTileCoords(dstX, dstY); petHandler->spawn(mOwner, mId, dstX, dstY); + mPetAi = true; } else if (!followDist || divX > followDist || divY > followDist) { + if (!mPetAi) + return; if (!dist) { fixPetSpawnPos(dstX, dstY); @@ -1645,6 +1649,9 @@ void Being::petLogic() return; } } + if (!mPetAi) + return; + if (mOwner->getCurrentAction() != BeingAction::ATTACK) { if (mAction == BeingAction::ATTACK) diff --git a/src/being/being.h b/src/being/being.h index a194bac72..119bcc637 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -920,6 +920,12 @@ class Being notfinal : public ActorSprite, int getManner() const { return mManner; } + void disablePetAi() + { mPetAi = false; } + + void enablePetAi() + { mPetAi = true; } + protected: /** * Updates name's location. @@ -1098,6 +1104,7 @@ class Being notfinal : public ActorSprite, bool mAway; bool mInactive; bool mNeedPosUpdate; + bool mPetAi; }; extern std::list<BeingCacheEntry*> beingInfoCache; |