[Client] Use the casters of damage-dealing spells as death reasons

0.6.3
David Cernat 7 years ago
parent 958b220835
commit 8ce225b1cc

@ -20,6 +20,7 @@
#include "../mwmp/PlayerList.hpp" #include "../mwmp/PlayerList.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/ObjectList.hpp" #include "../mwmp/ObjectList.hpp"
#include "../mwmp/CellController.hpp"
#include "../mwmp/MechanicsHelper.hpp" #include "../mwmp/MechanicsHelper.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
@ -532,6 +533,30 @@ namespace MWMechanics
effectTick(target.getClass().getCreatureStats(target), target, EffectKey(*effectIt), magnitude); effectTick(target.getClass().getCreatureStats(target), target, EffectKey(*effectIt), magnitude);
bool isDead = target.getClass().getCreatureStats(target).isDead(); bool isDead = target.getClass().getCreatureStats(target).isDead();
/*
Start of tes3mp addition
If the victim was a LocalPlayer or LocalActor who died, record their attacker as the deathReason
*/
if (!wasDead && isDead)
{
bool isSuicide = target == caster || caster.isEmpty();
if (target == MWMechanics::getPlayer())
{
mwmp::Main::get().getLocalPlayer()->deathReason = isSuicide ?
"suicide" : caster.getClass().getName(caster);
}
else if (mwmp::Main::get().getCellController()->isLocalActor(target))
{
mwmp::Main::get().getCellController()->getLocalActor(target)->deathReason = isSuicide ?
"suicide" : caster.getClass().getName(caster);
}
}
/*
End of tes3mp addition
*/
if (!wasDead && isDead) if (!wasDead && isDead)
MWBase::Environment::get().getMechanicsManager()->actorKilled(target, caster); MWBase::Environment::get().getMechanicsManager()->actorKilled(target, caster);
} }

Loading…
Cancel
Save