From e2d6445f2a64c45437f9762b891413142c4a66a3 Mon Sep 17 00:00:00 2001 From: ANAND Date: Wed, 21 Aug 2019 18:34:47 +0530 Subject: [PATCH] Fix LocalPlayer::isDead always returning false if player is immortal --- src/client/localplayer.cpp | 5 +++++ src/client/localplayer.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp index 1b0b667c8..3007a86e3 100644 --- a/src/client/localplayer.cpp +++ b/src/client/localplayer.cpp @@ -732,6 +732,11 @@ v3f LocalPlayer::getEyeOffset() const return v3f(0, BS * eye_height, 0); } +bool LocalPlayer::isDead() const +{ + return !getCAO()->isImmortal() && hp == 0; +} + // 3D acceleration void LocalPlayer::accelerate(const v3f &target_speed, const f32 max_increase_H, const f32 max_increase_V, const bool use_pitch) diff --git a/src/client/localplayer.h b/src/client/localplayer.h index 252519aaa..539f1ba2a 100644 --- a/src/client/localplayer.h +++ b/src/client/localplayer.h @@ -149,7 +149,7 @@ public: bool getAutojump() const { return m_autojump; } - bool isDead() const { return hp <= 0; } + bool isDead() const; inline void addVelocity(const v3f &vel) { -- 2.25.1