[Client] Add die() method to DedicatedPlayer

pull/593/head
David Cernat 4 years ago
parent ae0e4a929f
commit 30b179c2dd

@ -459,6 +459,17 @@ void DedicatedPlayer::equipItem(std::string itemId, bool noSound)
}
}
void DedicatedPlayer::die()
{
MWMechanics::DynamicStat<float> 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;

@ -46,6 +46,7 @@ namespace mwmp
void playSpeech();
void equipItem(std::string itemId, bool noSound = false);
void die();
void resurrect();
void updateMarker();

@ -28,14 +28,7 @@ namespace mwmp
{
LOG_APPEND(TimedLog::LOG_INFO, "- Packet was about %s", player->npc.mName.c_str());
MWMechanics::DynamicStat<float> 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<DedicatedPlayer*>(player)->getPtr();
ptr.getClass().getCreatureStats(ptr).setHealth(health);
static_cast<DedicatedPlayer*>(player)->die();
}
}
};

Loading…
Cancel
Save