From d5c4c34759611adcac74de7f938c74b47a734863 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 9 Sep 2020 00:02:46 +0200 Subject: [PATCH] Ops --- Moose Development/Moose/Ops/ArmyGroup.lua | 2 ++ Moose Development/Moose/Ops/OpsGroup.lua | 41 ++++++++++++++++------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Moose Development/Moose/Ops/ArmyGroup.lua b/Moose Development/Moose/Ops/ArmyGroup.lua index 5af542aaf..eebcc594c 100644 --- a/Moose Development/Moose/Ops/ArmyGroup.lua +++ b/Moose Development/Moose/Ops/ArmyGroup.lua @@ -69,6 +69,8 @@ function ARMYGROUP:New(GroupName) self:SetDefaultAlarmstate() self:SetDetection() self:SetPatrolAdInfinitum(false) + + --self:AddWeaponRange(10, 32) -- Add FSM transitions. -- From State --> Event --> To State diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index c57f46d75..ee97086be 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -511,9 +511,9 @@ function OPSGROUP:GetWeaponData(BitType) BitType=BitType or ENUMS.WeaponFlag.Auto if self.weaponData[BitType] then - return self.wself.weaponData[BitType] + return self.weaponData[BitType] else - return self.wself.weaponData[ENUMS.WeaponFlag.Auto] + return self.weaponData[ENUMS.WeaponFlag.Auto] end end @@ -2469,18 +2469,35 @@ function OPSGROUP:RouteToMission(mission, delay) elseif mission.type==AUFTRAG.Type.ARTY then + -- Get weapon range. local weapondata=self:GetWeaponData(mission.engageWeaponType) - local targetcoord=mission:GetTargetCoordinate() + if weapondata then - local heading=self:GetCoordinate():HeadingTo(targetcoord) - - local dist=self:GetCoordinate():Get2DDistance(targetcoord) - - if dist>weapondata.RangeMax then - waypointcoord=self:GetCoordinate():Translate(dist-weapondata.RangeMax, heading) - elseif distweapondata.RangeMax then + local d=dist-weapondata.RangeMax + d=(1.1)*d + + -- New waypoint coord. + waypointcoord=self:GetCoordinate():Translate(d, heading) + elseif dist=5*60 then + if holdtime>=10*60 then self:E(self.lid..string.format("WARNING: Group came to an unexpected standstill. Speed=%.1f<%.1f m/s expected for %d sec", speed, ExpectedSpeed, holdtime))