mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-02 06:36:41 +00:00
[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/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…
Reference in a new issue