diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 87bf1afd5..23aa76e5d 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -459,6 +459,17 @@ void DedicatedPlayer::equipItem(std::string itemId, bool noSound) } } +void DedicatedPlayer::die() +{ + MWMechanics::DynamicStat health; + creatureStats.mDead = true; + health.readState(creatureStats.mDynamic[0]); + health.setCurrent(0); + health.writeState(creatureStats.mDynamic[0]); + + ptr.getClass().getCreatureStats(ptr).setHealth(health); +} + void DedicatedPlayer::resurrect() { creatureStats.mDead = false; diff --git a/apps/openmw/mwmp/DedicatedPlayer.hpp b/apps/openmw/mwmp/DedicatedPlayer.hpp index 808d43a72..f9359a8b2 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.hpp +++ b/apps/openmw/mwmp/DedicatedPlayer.hpp @@ -46,6 +46,7 @@ namespace mwmp void playSpeech(); void equipItem(std::string itemId, bool noSound = false); + void die(); void resurrect(); void updateMarker(); diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerDeath.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerDeath.hpp index 59253dbd8..2836f4b4b 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerDeath.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerDeath.hpp @@ -28,14 +28,7 @@ namespace mwmp { LOG_APPEND(TimedLog::LOG_INFO, "- Packet was about %s", player->npc.mName.c_str()); - MWMechanics::DynamicStat health; - player->creatureStats.mDead = true; - health.readState(player->creatureStats.mDynamic[0]); - health.setCurrent(0); - health.writeState(player->creatureStats.mDynamic[0]); - - MWWorld::Ptr ptr = static_cast(player)->getPtr(); - ptr.getClass().getCreatureStats(ptr).setHealth(health); + static_cast(player)->die(); } } };