diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index c041ccd38..972f57267 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -553,9 +553,10 @@ namespace MWClass /* Start of tes3mp addition - If the attacker was the LocalPlayer or LocalActor, record their target and send a packet with it + If the attacker was the LocalPlayer or LocalActor, record their target and send a + packet with it - If the victim was a LocalActor who died, record their attacker as the deathReason + If the victim was a LocalActor who died, record their attacker as the killer */ mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(attacker); diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index bb5705980..9abc7ceb3 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -966,12 +966,13 @@ namespace MWClass /* Start of tes3mp addition - If the attacker was the LocalPlayer or LocalActor, record their target and send a packet with it + If the attacker was the LocalPlayer or LocalActor, record their target and send a + packet with it If the victim was the LocalPlayer, check whether packets should be sent about their new dynamic stats and position - If the victim was a LocalActor who died, record their attacker as the deathReason + If the victim was a LocalActor who died, record their attacker as the killer */ mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(attacker); diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 84893bd14..70869e9d1 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -842,6 +842,22 @@ namespace MWMechanics if (isDamageEffect) { + /* + Start of tes3mp addition + + If the victim was a LocalActor who died, record the caster as the killer + */ + if (mwmp::Main::get().getCellController()->isLocalActor(ptr)) + { + bool isSuicide = ptr == caster || caster.isEmpty(); + + mwmp::Main::get().getCellController()->getLocalActor(ptr)->killer = isSuicide ? + MechanicsHelper::getTarget(ptr) : MechanicsHelper::getTarget(caster); + } + /* + End of tes3mp addition + */ + if (caster == player || playerFollowers.find(caster) != playerFollowers.end()) { if (caster.getClass().getNpcStats(caster).isWerewolf()) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 419453555..36800ede2 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -537,7 +537,7 @@ namespace MWMechanics /* Start of tes3mp addition - If the victim was a LocalPlayer or LocalActor who died, record their attacker as the deathReason + If the victim was a LocalPlayer or LocalActor who died, record the caster as the killer */ if (!wasDead && isDead) {