forked from mirror/openmw-tes3mp
[Client] Use the casters of damage-dealing spells as death reasons
This commit is contained in:
parent
958b220835
commit
8ce225b1cc
1 changed files with 25 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "../mwmp/PlayerList.hpp"
|
||||
#include "../mwmp/LocalPlayer.hpp"
|
||||
#include "../mwmp/ObjectList.hpp"
|
||||
#include "../mwmp/CellController.hpp"
|
||||
#include "../mwmp/MechanicsHelper.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
@ -532,6 +533,30 @@ namespace MWMechanics
|
|||
effectTick(target.getClass().getCreatureStats(target), target, EffectKey(*effectIt), magnitude);
|
||||
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)
|
||||
MWBase::Environment::get().getMechanicsManager()->actorKilled(target, caster);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue