summaryrefslogtreecommitdiff
path: root/src/being/localplayer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-02 17:56:13 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-02 17:56:13 +0300
commit1003a7a74f72f17f59f4a74eacf95a1744a64506 (patch)
tree59e3dfae9c470426dea48b4b3aa221c40800072e /src/being/localplayer.cpp
parentce2e90b35291abe32c47e21569a58e9eb22cc87b (diff)
downloadmv-1003a7a74f72f17f59f4a74eacf95a1744a64506.tar.gz
mv-1003a7a74f72f17f59f4a74eacf95a1744a64506.tar.bz2
mv-1003a7a74f72f17f59f4a74eacf95a1744a64506.tar.xz
mv-1003a7a74f72f17f59f4a74eacf95a1744a64506.zip
Move death dialog showing from playerhandler.
Diffstat (limited to 'src/being/localplayer.cpp')
-rw-r--r--src/being/localplayer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 935b64c70..a9a51bd56 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -110,6 +110,7 @@ extern SkillDialog *skillDialog;
LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
Being(id, ActorType::Player, subtype, nullptr),
AttributeListener(),
+ PlayerDeathListener(),
StatListener(),
mGMLevel(0),
mCrazyMoveState(0),
@@ -1106,6 +1107,13 @@ void LocalPlayer::attributeChanged(const int id,
case Attributes::LEVEL:
mLevel = newVal;
break;
+ case Attributes::HP:
+ if (oldVal != 0 && newVal == 0
+ && localPlayer->getCurrentAction() != BeingAction::DEAD)
+ {
+ PlayerDeathListener::distributeEvent();
+ }
+ break;
default:
break;
}
@@ -3276,3 +3284,13 @@ void LocalPlayer::setTestParticle(const std::string &fileName,
mTestParticleHash = UpdaterWindow::getFileHash(mTestParticleName);
}
}
+
+void LocalPlayer::playerDeath()
+{
+ if (mAction != BeingAction::DEAD)
+ {
+ setAction(BeingAction::DEAD, 0);
+ recalcSpritesOrder();
+ }
+}
+