mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
This commit is contained in:
parent
edb0032118
commit
d5c4c34759
@ -70,6 +70,8 @@ function ARMYGROUP:New(GroupName)
|
|||||||
self:SetDetection()
|
self:SetDetection()
|
||||||
self:SetPatrolAdInfinitum(false)
|
self:SetPatrolAdInfinitum(false)
|
||||||
|
|
||||||
|
--self:AddWeaponRange(10, 32)
|
||||||
|
|
||||||
-- Add FSM transitions.
|
-- Add FSM transitions.
|
||||||
-- From State --> Event --> To State
|
-- From State --> Event --> To State
|
||||||
self:AddTransition("*", "FullStop", "Holding") -- Hold position.
|
self:AddTransition("*", "FullStop", "Holding") -- Hold position.
|
||||||
|
|||||||
@ -511,9 +511,9 @@ function OPSGROUP:GetWeaponData(BitType)
|
|||||||
BitType=BitType or ENUMS.WeaponFlag.Auto
|
BitType=BitType or ENUMS.WeaponFlag.Auto
|
||||||
|
|
||||||
if self.weaponData[BitType] then
|
if self.weaponData[BitType] then
|
||||||
return self.wself.weaponData[BitType]
|
return self.weaponData[BitType]
|
||||||
else
|
else
|
||||||
return self.wself.weaponData[ENUMS.WeaponFlag.Auto]
|
return self.weaponData[ENUMS.WeaponFlag.Auto]
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -2469,18 +2469,35 @@ function OPSGROUP:RouteToMission(mission, delay)
|
|||||||
|
|
||||||
elseif mission.type==AUFTRAG.Type.ARTY then
|
elseif mission.type==AUFTRAG.Type.ARTY then
|
||||||
|
|
||||||
|
-- Get weapon range.
|
||||||
local weapondata=self:GetWeaponData(mission.engageWeaponType)
|
local weapondata=self:GetWeaponData(mission.engageWeaponType)
|
||||||
|
|
||||||
local targetcoord=mission:GetTargetCoordinate()
|
if weapondata then
|
||||||
|
|
||||||
local heading=self:GetCoordinate():HeadingTo(targetcoord)
|
-- Get target coordinate.
|
||||||
|
local targetcoord=mission:GetTargetCoordinate()
|
||||||
|
|
||||||
local dist=self:GetCoordinate():Get2DDistance(targetcoord)
|
-- Heading to target.
|
||||||
|
local heading=self:GetCoordinate():HeadingTo(targetcoord)
|
||||||
|
|
||||||
|
-- Distance to target.
|
||||||
|
local dist=self:GetCoordinate():Get2DDistance(targetcoord)
|
||||||
|
|
||||||
|
-- Check if we are within range.
|
||||||
|
if dist>weapondata.RangeMax then
|
||||||
|
local d=dist-weapondata.RangeMax
|
||||||
|
d=(1.1)*d
|
||||||
|
|
||||||
|
-- New waypoint coord.
|
||||||
|
waypointcoord=self:GetCoordinate():Translate(d, heading)
|
||||||
|
elseif dist<weapondata.RangeMin then
|
||||||
|
local d=dist-weapondata.RangeMin
|
||||||
|
d=(1.1)*d
|
||||||
|
|
||||||
|
-- New waypoint coord.
|
||||||
|
waypointcoord=self:GetCoordinate():Translate(d, heading)
|
||||||
|
end
|
||||||
|
|
||||||
if dist>weapondata.RangeMax then
|
|
||||||
waypointcoord=self:GetCoordinate():Translate(dist-weapondata.RangeMax, heading)
|
|
||||||
elseif dist<weapondata.RangeMin then
|
|
||||||
waypointcoord=self:GetCoordinate():Translate(dist-weapondata.RangeMin, heading)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -4638,7 +4655,7 @@ function OPSGROUP:_CheckStuck()
|
|||||||
-- Time we are holding.
|
-- Time we are holding.
|
||||||
local holdtime=Tnow-self.stuckTimestamp
|
local holdtime=Tnow-self.stuckTimestamp
|
||||||
|
|
||||||
if holdtime>=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))
|
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))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user