From 94863ed8ae05bebe2f09998d68c5b4a070865655 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 24 Nov 2020 22:00:36 +0100 Subject: [PATCH] Update OpsGroup.lua --- Moose Development/Moose/Ops/OpsGroup.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index 79240503b..d1abc64bd 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -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