From b745a33f182b1419649b8b1c709eba05749f2d0e Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 5 May 2017 20:38:28 +0300 Subject: [PATCH] [Client] Resurrect DedicatedActors that aren't supposed to be dead --- apps/openmw/mwmp/DedicatedActor.cpp | 4 ++++ apps/openmw/mwmp/DedicatedPlayer.cpp | 12 +++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwmp/DedicatedActor.cpp b/apps/openmw/mwmp/DedicatedActor.cpp index cc51df983..d37923385 100644 --- a/apps/openmw/mwmp/DedicatedActor.cpp +++ b/apps/openmw/mwmp/DedicatedActor.cpp @@ -152,6 +152,10 @@ void DedicatedActor::setStatsDynamic() MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr); MWMechanics::DynamicStat value; + // Resurrect this Actor if it's not supposed to be dead according to its authority + if (creatureStats.mDynamic[0].mCurrent > 0) + ptrCreatureStats->resurrect(); + for (int i = 0; i < 3; ++i) { value.readState(creatureStats.mDynamic[i]); diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index e03e0bf7f..ee2bf7d8e 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -64,12 +64,11 @@ void DedicatedPlayer::update(float dt) return; } - value.readState(creatureStats.mDynamic[0]); - ptrCreatureStats->setHealth(value); - value.readState(creatureStats.mDynamic[1]); - ptrCreatureStats->setMagicka(value); - value.readState(creatureStats.mDynamic[2]); - ptrCreatureStats->setFatigue(value); + for (int i = 0; i < 3; ++i) + { + value.readState(creatureStats.mDynamic[i]); + ptrCreatureStats->setDynamic(i, value); + } if (ptrCreatureStats->isDead()) ptrCreatureStats->resurrect(); @@ -84,7 +83,6 @@ void DedicatedPlayer::update(float dt) ptrCreatureStats->setAiSetting(MWMechanics::CreatureStats::AI_Flee, 0); ptrCreatureStats->setAiSetting(MWMechanics::CreatureStats::AI_Hello, 0); - //ptrNpcStats->setBaseDisposition(255); move(dt); updateAnimFlags(); }