1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 20:36:42 +00:00

[Client] Don't apply spell effects unilaterally on DedicatedPlayers

This commit is contained in:
David Cernat 2020-11-17 17:51:13 +02:00
parent 1dccd75238
commit b1ce90076e

View file

@ -238,7 +238,16 @@ namespace MWMechanics
if (!appliedOnce) if (!appliedOnce)
effect.mDuration = std::max(1.f, effect.mDuration); effect.mDuration = std::max(1.f, effect.mDuration);
if (effect.mDuration == 0) /*
Start of tes3mp change (major)
If the target is a DedicatedPlayer, don't apply effects to them unilaterally on this client
and wait for the server's response to the other client to apply the effects for us
*/
if (effect.mDuration == 0 && !mwmp::PlayerList::isDedicatedPlayer(target))
/*
End of tes3mp change (major)
*/
{ {
// We still should add effect to list to allow GetSpellEffects to detect this spell // We still should add effect to list to allow GetSpellEffects to detect this spell
appliedLastingEffects.push_back(effect); appliedLastingEffects.push_back(effect);
@ -251,7 +260,7 @@ namespace MWMechanics
/* /*
Start of tes3mp addition Start of tes3mp addition
If the victim was a LocalPlayer or LocalActor who died, record the caster as the killer If the target was a LocalPlayer or LocalActor who died, record the caster as the killer
*/ */
if (!wasDead && isDead) if (!wasDead && isDead)
{ {
@ -275,7 +284,16 @@ namespace MWMechanics
if (!wasDead && isDead) if (!wasDead && isDead)
MWBase::Environment::get().getMechanicsManager()->actorKilled(target, caster); MWBase::Environment::get().getMechanicsManager()->actorKilled(target, caster);
} }
else /*
Start of tes3mp change (major)
If the target is a DedicatedPlayer, don't apply effects to them unilaterally on this client
and wait for the server's response to the other client to apply the effects for us
*/
else if (!mwmp::PlayerList::isDedicatedPlayer(target))
/*
End of tes3mp change (major)
*/
{ {
effect.mTimeLeft = effect.mDuration; effect.mTimeLeft = effect.mDuration;