mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 07:32:00 -04:00
[Client] Synchronize positions for actors during death animations
This needs some improvements, because: 1) Sometimes the cell authority sends the death animation too late and a different one gets played on the other clients 2) There is probably a simpler check that can be done for position changes during a death animation.
This commit is contained in:
parent
9b8818687d
commit
4b27f8986b
@ -2793,6 +2793,17 @@ CharacterController::KillResult CharacterController::kill()
|
|||||||
return Result_DeathAnimPlaying;
|
return Result_DeathAnimPlaying;
|
||||||
if (!cStats.isDeathAnimationFinished())
|
if (!cStats.isDeathAnimationFinished())
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
*/
|
||||||
|
if (mwmp::Main::get().getCellController()->isLocalActor(mPtr))
|
||||||
|
{
|
||||||
|
mwmp::Main::get().getCellController()->getLocalActor(mPtr)->creatureStats.mDeathAnimationFinished = true;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
|
|
||||||
cStats.setDeathAnimationFinished(true);
|
cStats.setDeathAnimationFinished(true);
|
||||||
return Result_DeathAnimJustFinished;
|
return Result_DeathAnimJustFinished;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ LocalActor::LocalActor()
|
|||||||
killer.name = "";
|
killer.name = "";
|
||||||
|
|
||||||
creatureStats.mDead = false;
|
creatureStats.mDead = false;
|
||||||
|
creatureStats.mDeathAnimationFinished = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalActor::~LocalActor()
|
LocalActor::~LocalActor()
|
||||||
@ -59,7 +60,7 @@ void LocalActor::update(bool forceUpdate)
|
|||||||
updateStatsDynamic(forceUpdate);
|
updateStatsDynamic(forceUpdate);
|
||||||
updateEquipment(forceUpdate, false);
|
updateEquipment(forceUpdate, false);
|
||||||
|
|
||||||
if (forceUpdate || !creatureStats.mDead)
|
if (forceUpdate || !creatureStats.mDeathAnimationFinished)
|
||||||
{
|
{
|
||||||
updatePosition(forceUpdate);
|
updatePosition(forceUpdate);
|
||||||
updateAnimFlags(forceUpdate);
|
updateAnimFlags(forceUpdate);
|
||||||
@ -87,8 +88,19 @@ void LocalActor::updateCell()
|
|||||||
|
|
||||||
void LocalActor::updatePosition(bool forceUpdate)
|
void LocalActor::updatePosition(bool forceUpdate)
|
||||||
{
|
{
|
||||||
bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 ||
|
bool posIsChanging = false;
|
||||||
direction.rot[0] != 0 || direction.rot[1] != 0 || direction.rot[2] != 0);
|
|
||||||
|
if (creatureStats.mDead)
|
||||||
|
{
|
||||||
|
ESM::Position ptrPosition = ptr.getRefData().getPosition();
|
||||||
|
posIsChanging = position.pos[0] != ptrPosition.pos[0] || position.pos[1] != ptrPosition.pos[1] ||
|
||||||
|
position.pos[2] != ptrPosition.pos[2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
posIsChanging = direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 ||
|
||||||
|
direction.rot[0] != 0 || direction.rot[1] != 0 || direction.rot[2] != 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (forceUpdate || posIsChanging || posWasChanged)
|
if (forceUpdate || posIsChanging || posWasChanged)
|
||||||
{
|
{
|
||||||
@ -191,6 +203,7 @@ void LocalActor::updateStatsDynamic(bool forceUpdate)
|
|||||||
fatigue.writeState(creatureStats.mDynamic[2]);
|
fatigue.writeState(creatureStats.mDynamic[2]);
|
||||||
|
|
||||||
creatureStats.mDead = ptrCreatureStats->isDead();
|
creatureStats.mDead = ptrCreatureStats->isDead();
|
||||||
|
creatureStats.mDeathAnimationFinished = ptrCreatureStats->isDeathAnimationFinished();
|
||||||
|
|
||||||
mwmp::Main::get().getNetworking()->getActorList()->addStatsDynamicActor(*this);
|
mwmp::Main::get().getNetworking()->getActorList()->addStatsDynamicActor(*this);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user