Update OpsGroup.lua

This commit is contained in:
Frank 2020-11-24 22:00:36 +01:00
parent 770fb3228f
commit 94863ed8ae

View File

@ -3497,8 +3497,15 @@ function OPSGROUP:SetLaserTarget(Target)
if Target then
-- Check if we have a POSITIONABLE.
if Target:IsInstanceOf("POSITIONABLE") then
-- Check object type.
if Target:IsInstanceOf("SCENERY") then
-- Scenery as target. Treat it like a coordinate. Set offset to 1 meter above ground.
self.spot.TargetType=0
self.spot.offsetTarget={x=0, y=1, z=0}
elseif Target:IsInstanceOf("POSITIONABLE") then
local target=Target --Wrapper.Positionable#POSITIONABLE
if target:IsAlive() then
@ -3535,13 +3542,11 @@ function OPSGROUP:SetLaserTarget(Target)
end
elseif Target:IsInstanceOf("COORDINATE") then
-- Coordinate as target.
self.spot.TargetType=0
self.spot.offsetTarget={x=0, y=0, z=0}
elseif Target:IsInstanceOf("SCENERY") then
-- Coordinate as target.
self.spot.TargetType=0
self.spot.offsetTarget={x=0, y=1, z=0}
else
self:E(self.lid.."ERROR: LASER target should be a POSITIONABLE (GROUP, UNIT or STATIC) or a COORDINATE object!")
return