mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OpsGroup
This commit is contained in:
parent
f578fcfdc7
commit
5cf4833455
@ -2017,7 +2017,8 @@ function FLIGHTGROUP:onafterRTB(From, Event, To, airbase, SpeedTo, SpeedHold, Sp
|
||||
end
|
||||
|
||||
-- Clear all tasks.
|
||||
self:ClearTasks()
|
||||
-- Warning, looks like this can make DCS CRASH! Had this after calling RTB once passed the final waypoint.
|
||||
--self:ClearTasks()
|
||||
|
||||
-- Respawn?
|
||||
if routeto then
|
||||
|
||||
@ -676,7 +676,17 @@ function NAVYGROUP:onafterTurnIntoWind(From, Event, To, IntoWind)
|
||||
|
||||
self.intowind=IntoWind
|
||||
|
||||
self:I(self.lid..string.format("Steaming into wind: Heading=%03d Speed=%.1f knots, Tstart=%d Tstop=%d", IntoWind.Heading, IntoWind.Speed, IntoWind.Tstart, IntoWind.Tstop))
|
||||
-- Wind speed in m/s.
|
||||
local _,vwind=self:GetWind()
|
||||
|
||||
-- Convert to knots.
|
||||
vwind=UTILS.MpsToKnots(vwind)
|
||||
|
||||
-- Speed of carrier in m/s but at least 2 knots.
|
||||
local speed=math.max(IntoWind.Speed-vwind, 2)
|
||||
|
||||
-- Debug info.
|
||||
self:I(self.lid..string.format("Steaming into wind: Heading=%03d Speed=%.1f Vwind=%.1f Vtot=%.1f knots, Tstart=%d Tstop=%d", IntoWind.Heading, speed, vwind, speed+vwind, IntoWind.Tstart, IntoWind.Tstop))
|
||||
|
||||
local distance=UTILS.NMToMeters(1000)
|
||||
|
||||
@ -685,8 +695,8 @@ function NAVYGROUP:onafterTurnIntoWind(From, Event, To, IntoWind)
|
||||
local coord=self:GetCoordinate()
|
||||
local Coord=coord:Translate(distance, IntoWind.Heading)
|
||||
|
||||
wp[1]=coord:WaypointNaval(IntoWind.Speed)
|
||||
wp[2]=Coord:WaypointNaval(IntoWind.Speed)
|
||||
wp[1]=coord:WaypointNaval(UTILS.KnotsToKmph(speed))
|
||||
wp[2]=Coord:WaypointNaval(UTILS.KnotsToKmph(speed))
|
||||
|
||||
self:Route(wp)
|
||||
|
||||
@ -921,7 +931,7 @@ end
|
||||
--- Add an a waypoint to the route.
|
||||
-- @param #NAVYGROUP self
|
||||
-- @param Core.Point#COORDINATE coordinate The coordinate of the waypoint. Use COORDINATE:SetAltitude(altitude) to define the altitude.
|
||||
-- @param #number speed Speed in knots. Default is 70% of max speed.
|
||||
-- @param #number speed Speed in knots. Default is default cruise speed or 70% of max speed.
|
||||
-- @param #number wpnumber Waypoint number. Default at the end.
|
||||
-- @param #boolean updateroute If true or nil, call UpdateRoute. If false, no call.
|
||||
-- @return #number Waypoint index.
|
||||
@ -935,7 +945,7 @@ function NAVYGROUP:AddWaypoint(coordinate, speed, wpnumber, updateroute)
|
||||
end
|
||||
|
||||
-- Speed in knots.
|
||||
speed=speed or self.speedmax*0.7
|
||||
speed=speed or self:GetSpeedCruise()
|
||||
|
||||
-- Speed at waypoint.
|
||||
local speedkmh=UTILS.KnotsToKmph(speed)
|
||||
|
||||
@ -2156,8 +2156,13 @@ end
|
||||
--- Route group along waypoints.
|
||||
-- @param #OPSGROUP self
|
||||
-- @param #table waypoints Table of waypoints.
|
||||
-- @default
|
||||
-- @return #OPSGROUP self
|
||||
function OPSGROUP:Route(waypoints)
|
||||
function OPSGROUP:Route(waypoints, delay)
|
||||
|
||||
if delay and delay>0 then
|
||||
self:ScheduleOnce(delay, OPSGROUP.Route, self, waypoints)
|
||||
else
|
||||
|
||||
if self:IsAlive() then
|
||||
|
||||
@ -2181,6 +2186,7 @@ function OPSGROUP:Route(waypoints)
|
||||
else
|
||||
self:E(self.lid.."ERROR: Group is not alive! Cannot route group.")
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user