Reviewed-on: #49 Co-authored-by: dutchie031 <timrorije@gmail.com>
This commit was merged in pull request #49.
This commit is contained in:
@@ -21,7 +21,7 @@ end
|
||||
|
||||
---comment
|
||||
---@param weapon Weapon
|
||||
function RunwayBombingTracker:OnWeaponFired(unit, weapon, target)
|
||||
function RunwayBombingTracker:OnWeaponFired(_, weapon, _)
|
||||
|
||||
if weapon == nil then
|
||||
return
|
||||
@@ -30,7 +30,7 @@ function RunwayBombingTracker:OnWeaponFired(unit, weapon, target)
|
||||
local desc = weapon:getDesc()
|
||||
local isTrackable = desc.category == Weapon.Category.BOMB or (desc.category == Weapon.Category.MISSILE and desc.missileCategory == Weapon.MissileCategory.CRUISE)
|
||||
if isTrackable == true then
|
||||
|
||||
|
||||
---@type WeaponTrackingArgs
|
||||
local weaponTrackingArgs = {
|
||||
weapon = weapon,
|
||||
@@ -56,12 +56,14 @@ end
|
||||
---@field self RunwayBombingTracker
|
||||
|
||||
---@private
|
||||
---@param time number
|
||||
---@param weaponTrackingArgs WeaponTrackingArgs
|
||||
---@return number?
|
||||
function RunwayBombingTracker.trackWeaponTask(weaponTrackingArgs, time)
|
||||
|
||||
local weapon = weaponTrackingArgs.weapon
|
||||
local self = weaponTrackingArgs.self
|
||||
|
||||
|
||||
if not weapon or weapon:isExist() == false then return nil end
|
||||
|
||||
local pos = weapon:getPoint()
|
||||
@@ -83,11 +85,7 @@ function RunwayBombingTracker.trackWeaponTask(weaponTrackingArgs, time)
|
||||
x = pos.x + velocity.x * nextInterval,
|
||||
y = pos.z + velocity.z * nextInterval
|
||||
}
|
||||
|
||||
|
||||
self:OnWeaponImpact(weapon:getDesc(), impactPoint)
|
||||
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
@@ -106,11 +104,10 @@ function RunwayBombingTracker:OnWeaponImpact(weaponDesc, impactPoint)
|
||||
|
||||
self._logger:debug("RunwayBombingTracker:OnWeaponImpact")
|
||||
|
||||
local warhead = weaponDesc.warhead
|
||||
local explosiveMass = warhead.explosiveMass or warhead.shapedExplosiveMass
|
||||
|
||||
for runway, strikeMission in pairs(self.trackedRunways) do
|
||||
local warhead = weaponDesc.warhead --[[@as table]]
|
||||
local explosiveMass = (warhead.explosiveMass or warhead.shapedExplosiveMass) --[[@as number]]
|
||||
|
||||
for _, strikeMission in pairs(self.trackedRunways) do
|
||||
local zone= strikeMission:GetRunwayZone()
|
||||
|
||||
if Util.is3dPointInZone({ x = impactPoint.x, z = impactPoint.y, y = 0 }, zone) then
|
||||
|
||||
Reference in New Issue
Block a user