mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 23:36:42 +00:00
[Client] Add die() method to DedicatedPlayer
This commit is contained in:
parent
ae0e4a929f
commit
30b179c2dd
3 changed files with 13 additions and 8 deletions
|
@ -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()
|
void DedicatedPlayer::resurrect()
|
||||||
{
|
{
|
||||||
creatureStats.mDead = false;
|
creatureStats.mDead = false;
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace mwmp
|
||||||
void playSpeech();
|
void playSpeech();
|
||||||
|
|
||||||
void equipItem(std::string itemId, bool noSound = false);
|
void equipItem(std::string itemId, bool noSound = false);
|
||||||
|
void die();
|
||||||
void resurrect();
|
void resurrect();
|
||||||
|
|
||||||
void updateMarker();
|
void updateMarker();
|
||||||
|
|
|
@ -28,14 +28,7 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
LOG_APPEND(TimedLog::LOG_INFO, "- Packet was about %s", player->npc.mName.c_str());
|
LOG_APPEND(TimedLog::LOG_INFO, "- Packet was about %s", player->npc.mName.c_str());
|
||||||
|
|
||||||
MWMechanics::DynamicStat<float> health;
|
static_cast<DedicatedPlayer*>(player)->die();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue