Update Scoring.lua

Better check for Scenery hits where target category is usually nil
This commit is contained in:
Thomas 2025-08-06 12:27:28 +02:00 committed by GitHub
parent e9194c59f4
commit 029f7a3f5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1025,6 +1025,11 @@ function SCORING:_EventOnHit( Event )
TargetCategory = Event.TgtCategory
TargetType = Event.TgtTypeName
-- Scenery hit
if (not TargetCategory) and TargetUNIT ~= nil and TargetUnit:IsInstanceOf("SCENERY") then
TargetCategory = Unit.Category.STRUCTURE
end
TargetUnitCoalition = _SCORINGCoalition[TargetCoalition]
TargetUnitCategory = _SCORINGCategory[TargetCategory]
TargetUnitType = TargetType