From c58918e00257024c3a2e60c8bc0682ee0f462f68 Mon Sep 17 00:00:00 2001 From: "Mr.Alien" <124381209+MrAlien753@users.noreply.github.com> Date: Sat, 4 Feb 2023 22:36:16 +0100 Subject: [PATCH] Add missing part of code in previous commit (#1910) --- Moose Development/Moose/Functional/Scoring.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Moose Development/Moose/Functional/Scoring.lua b/Moose Development/Moose/Functional/Scoring.lua index 57d0c3fc6..b91e16fa1 100644 --- a/Moose Development/Moose/Functional/Scoring.lua +++ b/Moose Development/Moose/Functional/Scoring.lua @@ -1117,7 +1117,18 @@ function SCORING:_EventOnHit( Event ) PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0 PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0 PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT + -- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth + if PlayerHit.UNIT.ThreatType == nil then PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel() + -- if this fails for some reason, set a good default value + if PlayerHit.ThreatType == nil then + PlayerHit.ThreatLevel = 1 + PlayerHit.ThreatType = "Unknown" + end + else + PlayerHit.ThreatLevel = PlayerHit.UNIT.ThreatLevel + PlayerHit.ThreatType = PlayerHit.UNIT.ThreatType + end -- Only grant hit scores if there was more than one second between the last hit. if timer.getTime() - PlayerHit.TimeStamp > 1 then