mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Changed Suppression Fire to Suppressive Fire
This commit is contained in:
parent
79afc5a856
commit
b923159298
@ -117,6 +117,7 @@
|
|||||||
-- @field #number respawn_delay Delay in seconds until repawn happens after landing.
|
-- @field #number respawn_delay Delay in seconds until repawn happens after landing.
|
||||||
-- @field #table markerids Array with marker IDs.
|
-- @field #table markerids Array with marker IDs.
|
||||||
-- @field #table waypointdescriptions Table with strings for waypoint descriptions of markers.
|
-- @field #table waypointdescriptions Table with strings for waypoint descriptions of markers.
|
||||||
|
-- @field #table waypointstatus Table with strings of waypoint status.
|
||||||
-- @field #string livery Livery of the aircraft set by user.
|
-- @field #string livery Livery of the aircraft set by user.
|
||||||
-- @field #string skill Skill of AI.
|
-- @field #string skill Skill of AI.
|
||||||
-- @field #boolean ATCswitch Enable/disable ATC if set to true/false.
|
-- @field #boolean ATCswitch Enable/disable ATC if set to true/false.
|
||||||
@ -329,6 +330,7 @@ RAT={
|
|||||||
respawn_delay=nil, -- Delay in seconds until repawn happens after landing.
|
respawn_delay=nil, -- Delay in seconds until repawn happens after landing.
|
||||||
markerids={}, -- Array with marker IDs.
|
markerids={}, -- Array with marker IDs.
|
||||||
waypointdescriptions={}, -- Array with descriptions for waypoint markers.
|
waypointdescriptions={}, -- Array with descriptions for waypoint markers.
|
||||||
|
waypointstatus={}, -- Array with status info on waypoints.
|
||||||
livery=nil, -- Livery of the aircraft.
|
livery=nil, -- Livery of the aircraft.
|
||||||
skill="High", -- Skill of AI.
|
skill="High", -- Skill of AI.
|
||||||
ATCswitch=true, -- Enable ATC.
|
ATCswitch=true, -- Enable ATC.
|
||||||
@ -370,17 +372,25 @@ RAT.wp={
|
|||||||
--- RAT aircraft status.
|
--- RAT aircraft status.
|
||||||
-- @list status
|
-- @list status
|
||||||
RAT.status={
|
RAT.status={
|
||||||
Birth="Born",
|
-- Waypoint states.
|
||||||
StartingEngines="Starting engines",
|
Departure="At departure point",
|
||||||
TaxiToRunway="Taxiing to runway",
|
|
||||||
Takeoff="On climb after takeoff",
|
|
||||||
Climb="Climbing",
|
Climb="Climbing",
|
||||||
CruiseBegin="Cruising",
|
Cruise="Cruising",
|
||||||
CruiseEnd="Descending after cruise",
|
Uturn="Flying back home",
|
||||||
Descent="Descending to holding point",
|
Descent="Descending",
|
||||||
|
DescentHolding="Descend to holding point",
|
||||||
Holding="Holding",
|
Holding="Holding",
|
||||||
Final="On final",
|
Destination="Arrived at destination",
|
||||||
Landed="Landed and taxiing to parking",
|
-- Event states.
|
||||||
|
EventBirthAir="Born in air",
|
||||||
|
EventBirth="Born on ground",
|
||||||
|
EventEngineStartAir="Started engines in air",
|
||||||
|
EventEngineStart="Started engines on ground",
|
||||||
|
EventTakeoff="Took off",
|
||||||
|
EventLand="Landed",
|
||||||
|
EventEngineShutdown="Engines shut down",
|
||||||
|
EventDead="Dead",
|
||||||
|
EventCrash="Crashed",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- RAT friendly coalitions.
|
--- RAT friendly coalitions.
|
||||||
@ -632,7 +642,7 @@ function RAT:Spawn(naircraft)
|
|||||||
self:HandleEvent(EVENTS.Land, self._OnLand)
|
self:HandleEvent(EVENTS.Land, self._OnLand)
|
||||||
self:HandleEvent(EVENTS.EngineShutdown, self._OnEngineShutdown)
|
self:HandleEvent(EVENTS.EngineShutdown, self._OnEngineShutdown)
|
||||||
self:HandleEvent(EVENTS.Dead, self._OnDead)
|
self:HandleEvent(EVENTS.Dead, self._OnDead)
|
||||||
--self:HandleEvent(EVENTS.Crash, self._OnCrash)
|
self:HandleEvent(EVENTS.Crash, self._OnCrash)
|
||||||
-- TODO: add hit event?
|
-- TODO: add hit event?
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -1595,6 +1605,7 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- max height if we only would descent to holding point for the given distance
|
-- max height if we only would descent to holding point for the given distance
|
||||||
|
-- TODO: Add case for destination zone. We could allow a higher max because no descent is necessary.
|
||||||
if takeoff==RAT.wp.air then
|
if takeoff==RAT.wp.air then
|
||||||
local H_departure_max = d_total * math.tan(AlphaDescent) + H_holding + h_holding
|
local H_departure_max = d_total * math.tan(AlphaDescent) + H_holding + h_holding
|
||||||
H_departure=math.min(H_departure, H_departure_max)
|
H_departure=math.min(H_departure, H_departure_max)
|
||||||
@ -1699,12 +1710,6 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
FLcruise=self.FLuser
|
FLcruise=self.FLuser
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Cruise alt should not be below departure alt
|
|
||||||
--FLcruise = math.max(FLcruise, H_departure)
|
|
||||||
|
|
||||||
-- Cruise alt should not be above max FL
|
|
||||||
--FLcruise = math.min(FLcruise, FLmax)
|
|
||||||
|
|
||||||
-- Climb and descent heights.
|
-- Climb and descent heights.
|
||||||
local h_climb = (FLcruise-H_departure) --math.abs ?
|
local h_climb = (FLcruise-H_departure) --math.abs ?
|
||||||
local h_descent = FLcruise - (H_holding+h_holding)
|
local h_descent = FLcruise - (H_holding+h_holding)
|
||||||
@ -1747,6 +1752,13 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
text=text..string.format("FLmin = %6.1f m ASL = FL%03d\n", FLmin, FLmin/RAT.unit.FL2m)
|
text=text..string.format("FLmin = %6.1f m ASL = FL%03d\n", FLmin, FLmin/RAT.unit.FL2m)
|
||||||
text=text..string.format("FLcruise = %6.1f m ASL = FL%03d\n", FLcruise, FLcruise/RAT.unit.FL2m)
|
text=text..string.format("FLcruise = %6.1f m ASL = FL%03d\n", FLcruise, FLcruise/RAT.unit.FL2m)
|
||||||
text=text..string.format("FLmax = %6.1f m ASL = FL%03d\n", FLmax, FLmax/RAT.unit.FL2m)
|
text=text..string.format("FLmax = %6.1f m ASL = FL%03d\n", FLmax, FLmax/RAT.unit.FL2m)
|
||||||
|
text=text..string.format("\nMax heights and distances:\n")
|
||||||
|
text=text..string.format("d_climb_max = %6.1f km\n", d_climb_max/1000)
|
||||||
|
text=text..string.format("d_cruise_max = %6.1f km\n", d_cruise_max/1000)
|
||||||
|
text=text..string.format("d_descent_max = %6.1f km\n", d_descent_max/1000)
|
||||||
|
text=text..string.format("d_total_max = %6.1f km\n", d_total_max/1000)
|
||||||
|
text=text..string.format("h_climb_max = %6.1f m\n", h_climb_max)
|
||||||
|
text=text..string.format("h_descent_max = %6.1f m\n", h_descent_max)
|
||||||
text=text..string.format("\nAngles:\n")
|
text=text..string.format("\nAngles:\n")
|
||||||
text=text..string.format("Alpha climb = %6.1f Deg\n", math.deg(AlphaClimb))
|
text=text..string.format("Alpha climb = %6.1f Deg\n", math.deg(AlphaClimb))
|
||||||
text=text..string.format("Alpha descent = %6.1f Deg\n", math.deg(AlphaDescent))
|
text=text..string.format("Alpha descent = %6.1f Deg\n", math.deg(AlphaDescent))
|
||||||
@ -1762,24 +1774,130 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
d_cruise=100
|
d_cruise=100
|
||||||
end
|
end
|
||||||
|
|
||||||
--local waypoints
|
-- Waypoints and coordinates
|
||||||
local wp={}
|
local wp={}
|
||||||
|
local c={}
|
||||||
|
|
||||||
|
-- Departure/Take-off
|
||||||
|
c[#c+1]=Pdeparture
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, takeoff, c[#wp+1], VxClimb, H_departure, departure)
|
||||||
|
self.waypointdescriptions[#wp]="Departure"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Departure
|
||||||
|
|
||||||
|
-- Climb
|
||||||
|
if takeoff==RAT.wp.air then
|
||||||
|
|
||||||
|
-- Air start.
|
||||||
|
if d_climb < 1000 or d_cruise < 1000 then
|
||||||
|
-- We omit the climb phase completely and add it to the cruise part.
|
||||||
|
d_cruise=d_cruise+d_climb
|
||||||
|
else
|
||||||
|
-- Only one waypoint at the end of climb = begin of cruise.
|
||||||
|
c[#c+1]=c[#c]:Translate(d_climb, heading)
|
||||||
|
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c[#wp+1], VxCruise, FLcruise)
|
||||||
|
self.waypointdescriptions[#wp]="Begin of Cruise"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Cruise
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Ground start.
|
||||||
|
c[#c+1]=c[#c]:Translate(d_climb/2, heading)
|
||||||
|
c[#c+1]=c[#c]:Translate(d_climb/2, heading)
|
||||||
|
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.climb, c[#wp+1], VxClimb, H_departure+(FLcruise-H_departure)/2)
|
||||||
|
self.waypointdescriptions[#wp]="Climb"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Climb
|
||||||
|
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c[#wp+1], VxCruise, FLcruise)
|
||||||
|
self.waypointdescriptions[#wp]="Begin of Cruise"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Cruise
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Cruise
|
||||||
|
if self.destinationzone then
|
||||||
|
|
||||||
|
-- Next waypoint is already the final destination.
|
||||||
|
c[#c+1]=Pdestination
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.finalwp, c[#wp+1], VxCruise, FLcruise)
|
||||||
|
self.waypointdescriptions[#wp]="Final Destination"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Destination
|
||||||
|
|
||||||
|
elseif self.returnzone then
|
||||||
|
|
||||||
|
c[#c+1]=Pdestination
|
||||||
|
c[#c+1]=c[#c]:Translate(d_cruise/2, heading-180)
|
||||||
|
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c[#wp+1], VxCruise, FLcruise)
|
||||||
|
self.waypointdescriptions[#wp]="Return Zone"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Uturn
|
||||||
|
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c[#wp+1], VxCruise, FLcruise)
|
||||||
|
self.waypointdescriptions[#wp]="End of Cruise"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Descent
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
c[#c+1]=c[#c]:Translate(d_cruise, heading)
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c[#wp+1], VxCruise, FLcruise)
|
||||||
|
self.waypointdescriptions[#wp]="End of Cruise"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Descent
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Descent
|
||||||
|
if self.destinationzone then
|
||||||
|
-- Nothing to do.
|
||||||
|
elseif self.returnzone then
|
||||||
|
c[#c+1]=c[#c]:Translate(d_descent/2, heading-180)
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.descent, c[#wp+1], VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
||||||
|
self.waypointdescriptions[#wp]="Descent"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.DescentHolding
|
||||||
|
else
|
||||||
|
c[#c+1]=c[#c]:Translate(d_descent/2, heading)
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.descent, c[#wp+1], VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
||||||
|
self.waypointdescriptions[#wp]="Descent"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.DescentHolding
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Holding and final destination.
|
||||||
|
if self.destinationzone then
|
||||||
|
-- Nothing to do.
|
||||||
|
else
|
||||||
|
c[#c+1]=Pholding
|
||||||
|
c[#c+1]=Pdestination
|
||||||
|
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.holding, c[#wp+1], VxHolding, H_holding+h_holding)
|
||||||
|
self.waypointdescriptions[#wp]="Holding Point"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Holding
|
||||||
|
self.wp_holding=#wp
|
||||||
|
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.landing, c[#wp+1], VxFinal, H_departure, departure)
|
||||||
|
self.waypointdescriptions[#wp]="Destination"
|
||||||
|
self.waypointstatus[#wp]=RAT.status.Destination
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Final Waypoint
|
||||||
|
self.wp_final=#wp
|
||||||
|
|
||||||
|
--[[
|
||||||
if self.destinationzone then
|
if self.destinationzone then
|
||||||
|
|
||||||
-- Destination is a zone. No need for holding and landing point.
|
-- Destination is a zone. No need for holding and landing point.
|
||||||
local c0=Pdeparture
|
c[#c+1]=Pdeparture
|
||||||
local c1=c0:Translate(d_climb/2, heading)
|
c[#c+1]=c[#c]:Translate(d_climb/2, heading)
|
||||||
local c2=c1:Translate(d_climb/2, heading)
|
c[#c+1]=c[#c]:Translate(d_climb/2, heading)
|
||||||
local c3=Pdestination
|
c[#c+1]=Pdestination
|
||||||
|
|
||||||
wp[1]=self:_Waypoint(1, takeoff, c0, VxClimb, H_departure, departure)
|
wp[#wp+1]=self:_Waypoint(#wp+1, takeoff, c[#wp+1], VxClimb, H_departure, departure)
|
||||||
self.waypointdescriptions[1]="Departure"
|
self.waypointdescriptions[#wp+1]="Departure"
|
||||||
wp[2]=self:_Waypoint(2, RAT.wp.climb, c1, VxClimb, H_departure+(FLcruise-H_departure)/2)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.climb, c[#wp+1], VxClimb, H_departure+(FLcruise-H_departure)/2)
|
||||||
self.waypointdescriptions[2]="Climb"
|
self.waypointdescriptions[#wp+1]="Climb"
|
||||||
wp[3]=self:_Waypoint(3, RAT.wp.cruise, c2, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c[#wp+1], VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[3]="Begin of Cruise"
|
self.waypointdescriptions[#wp+1]="Begin of Cruise"
|
||||||
wp[4]=self:_Waypoint(4, RAT.wp.finalwp, c3, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.finalwp, c[#wp+1], VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[4]="Final Destination"
|
self.waypointdescriptions[#wp+1]="Final Destination"
|
||||||
|
|
||||||
-- Index of the final waypoint. Here used to despawn and respawn the aircraft.
|
-- Index of the final waypoint. Here used to despawn and respawn the aircraft.
|
||||||
self.wp_final=4
|
self.wp_final=4
|
||||||
@ -1797,22 +1915,22 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
local c7=Pdeparture
|
local c7=Pdeparture
|
||||||
|
|
||||||
-- Waypoints
|
-- Waypoints
|
||||||
wp[1]=self:_Waypoint(1, takeoff, c0, VxClimb, H_departure, departure)
|
wp[#wp+1]=self:_Waypoint(#wp+1, takeoff, c0, VxClimb, H_departure, departure)
|
||||||
self.waypointdescriptions[1]="Departure"
|
self.waypointdescriptions[#wp+1]="Departure"
|
||||||
wp[2]=self:_Waypoint(2, RAT.wp.climb, c1, VxClimb, H_departure+(FLcruise-H_departure)/2)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.climb, c1, VxClimb, H_departure+(FLcruise-H_departure)/2)
|
||||||
self.waypointdescriptions[2]="Climb"
|
self.waypointdescriptions[#wp+1]="Climb"
|
||||||
wp[3]=self:_Waypoint(3, RAT.wp.cruise, c2, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c2, VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[3]="Begin of Cruise"
|
self.waypointdescriptions[#wp+1]="Begin of Cruise"
|
||||||
wp[4]=self:_Waypoint(4, RAT.wp.cruise, c3, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c3, VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[4]="Return Zone"
|
self.waypointdescriptions[#wp+1]="Return Zone"
|
||||||
wp[5]=self:_Waypoint(5, RAT.wp.cruise, c4, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c4, VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[5]="End of Cruise"
|
self.waypointdescriptions[#wp+1]="End of Cruise"
|
||||||
wp[6]=self:_Waypoint(6, RAT.wp.descent, c5, VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.descent, c5, VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
||||||
self.waypointdescriptions[6]="Descent"
|
self.waypointdescriptions[#wp+1]="Descent"
|
||||||
wp[7]=self:_Waypoint(7, RAT.wp.holding, c6, VxHolding, H_holding+h_holding)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.holding, c6, VxHolding, H_holding+h_holding)
|
||||||
self.waypointdescriptions[7]="Holding Point"
|
self.waypointdescriptions[#wp+1]="Holding Point"
|
||||||
wp[8]=self:_Waypoint(8, RAT.wp.landing, c7, VxFinal, H_departure, departure)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.landing, c7, VxFinal, H_departure, departure)
|
||||||
self.waypointdescriptions[8]="Destination"
|
self.waypointdescriptions[#wp+1]="Destination"
|
||||||
|
|
||||||
-- Index of the holding and final waypoint.
|
-- Index of the holding and final waypoint.
|
||||||
self.wp_holding=7
|
self.wp_holding=7
|
||||||
@ -1832,16 +1950,21 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
local c4=Pdestination
|
local c4=Pdestination
|
||||||
|
|
||||||
-- Waypoints
|
-- Waypoints
|
||||||
wp[1]=self:_Waypoint(1, takeoff, c0, VxClimb, H_departure, departure)
|
wp[#wp+1]=self:_Waypoint(#wp+1, takeoff, c0, VxClimb, H_departure, departure)
|
||||||
self.waypointdescriptions[1]="Departure (air)"
|
self.waypointdescriptions[#wp+1]="Departure (air)"
|
||||||
wp[2]=self:_Waypoint(2, RAT.wp.cruise, c1, VxCruise, FLcruise)
|
self.waypointstatus[#wp+1]=RAT.status.DepartureAir
|
||||||
self.waypointdescriptions[2]="Cruise"
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c1, VxCruise, FLcruise)
|
||||||
wp[3]=self:_Waypoint(3, RAT.wp.descent, c2, VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
self.waypointdescriptions[#wp+1]="Cruise"
|
||||||
self.waypointdescriptions[3]="Descent"
|
self.waypointstatus[#wp+1]=RAT.status.CruiseBegin
|
||||||
wp[4]=self:_Waypoint(4, RAT.wp.holding, c3, VxHolding, H_holding+h_holding)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.descent, c2, VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
||||||
self.waypointdescriptions[4]="Holding Point"
|
self.waypointdescriptions[#wp+1]="Descent"
|
||||||
wp[5]=self:_Waypoint(5, RAT.wp.landing, c4, VxFinal, H_destination, destination)
|
self.waypointstatus[#wp+1]=RAT.status.Descent
|
||||||
self.waypointdescriptions[5]="Destination"
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.holding, c3, VxHolding, H_holding+h_holding)
|
||||||
|
self.waypointdescriptions[#wp+1]="Holding Point"
|
||||||
|
self.waypointstatus[#wp+1]=RAT.status.Holding
|
||||||
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.landing, c4, VxFinal, H_destination, destination)
|
||||||
|
self.waypointdescriptions[#wp+1]="Destination"
|
||||||
|
self.waypointstatus[#wp+1]=RAT.status.Destination
|
||||||
|
|
||||||
-- Index of the holing point for registering aircraft at ATC.
|
-- Index of the holing point for registering aircraft at ATC.
|
||||||
self.wp_holding=4
|
self.wp_holding=4
|
||||||
@ -1858,18 +1981,18 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
local c5=Pdestination
|
local c5=Pdestination
|
||||||
|
|
||||||
-- Waypoints
|
-- Waypoints
|
||||||
wp[1]=self:_Waypoint(1, takeoff, c0, VxClimb, H_departure, departure)
|
wp[#wp+1]=self:_Waypoint(#wp+1, takeoff, c0, VxClimb, H_departure, departure)
|
||||||
self.waypointdescriptions[1]="Departure (air)"
|
self.waypointdescriptions[#wp+1]="Departure (air)"
|
||||||
wp[2]=self:_Waypoint(2, RAT.wp.cruise, c1, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c1, VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[2]="Begin of Cruise"
|
self.waypointdescriptions[#wp+1]="Begin of Cruise"
|
||||||
wp[3]=self:_Waypoint(3, RAT.wp.cruise, c2, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c2, VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[3]="End of Cruise"
|
self.waypointdescriptions[#wp+1]="End of Cruise"
|
||||||
wp[4]=self:_Waypoint(4, RAT.wp.descent, c3, VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.descent, c3, VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
||||||
self.waypointdescriptions[4]="Descent"
|
self.waypointdescriptions[#wp+1]="Descent"
|
||||||
wp[5]=self:_Waypoint(5, RAT.wp.holding, c4, VxHolding, H_holding+h_holding)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.holding, c4, VxHolding, H_holding+h_holding)
|
||||||
self.waypointdescriptions[5]="Holding Point"
|
self.waypointdescriptions[#wp+1]="Holding Point"
|
||||||
wp[6]=self:_Waypoint(6, RAT.wp.landing, c5, VxFinal, H_destination, destination)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.landing, c5, VxFinal, H_destination, destination)
|
||||||
self.waypointdescriptions[6]="Destination"
|
self.waypointdescriptions[#wp+1]="Destination"
|
||||||
|
|
||||||
-- Index of the holing point for registering aircraft at ATC.
|
-- Index of the holing point for registering aircraft at ATC.
|
||||||
self.wp_holding=5
|
self.wp_holding=5
|
||||||
@ -1889,20 +2012,20 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
local c6=Pdestination
|
local c6=Pdestination
|
||||||
|
|
||||||
-- Waypoints
|
-- Waypoints
|
||||||
wp[1]=self:_Waypoint(1, takeoff, c0, VxClimb, H_departure, departure)
|
wp[#wp+1]=self:_Waypoint(#wp+1, takeoff, c0, VxClimb, H_departure, departure)
|
||||||
self.waypointdescriptions[1]="Departure"
|
self.waypointdescriptions[#wp+1]="Departure"
|
||||||
wp[2]=self:_Waypoint(2, RAT.wp.climb, c1, VxClimb, H_departure+(FLcruise-H_departure)/2)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.climb, c1, VxClimb, H_departure+(FLcruise-H_departure)/2)
|
||||||
self.waypointdescriptions[2]="Climb"
|
self.waypointdescriptions[#wp+1]="Climb"
|
||||||
wp[3]=self:_Waypoint(3, RAT.wp.cruise, c2, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c2, VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[3]="Begin of Cruise"
|
self.waypointdescriptions[#wp+1]="Begin of Cruise"
|
||||||
wp[4]=self:_Waypoint(4, RAT.wp.cruise, c3, VxCruise, FLcruise)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.cruise, c3, VxCruise, FLcruise)
|
||||||
self.waypointdescriptions[4]="End of Cruise"
|
self.waypointdescriptions[#wp+1]="End of Cruise"
|
||||||
wp[5]=self:_Waypoint(5, RAT.wp.descent, c4, VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.descent, c4, VxDescent, FLcruise-(FLcruise-(h_holding+H_holding))/2)
|
||||||
self.waypointdescriptions[5]="Descent"
|
self.waypointdescriptions[#wp+1]="Descent"
|
||||||
wp[6]=self:_Waypoint(6, RAT.wp.holding, c5, VxHolding, H_holding+h_holding)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.holding, c5, VxHolding, H_holding+h_holding)
|
||||||
self.waypointdescriptions[6]="Holding Point"
|
self.waypointdescriptions[#wp+1]="Holding Point"
|
||||||
wp[7]=self:_Waypoint(7, RAT.wp.landing, c6, VxFinal, H_destination, destination)
|
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.landing, c6, VxFinal, H_destination, destination)
|
||||||
self.waypointdescriptions[7]="Destination"
|
self.waypointdescriptions[#wp+1]="Destination"
|
||||||
|
|
||||||
-- Index of the holing point for registering aircraft at ATC.
|
-- Index of the holing point for registering aircraft at ATC.
|
||||||
self.wp_holding=6
|
self.wp_holding=6
|
||||||
@ -1911,6 +2034,7 @@ function RAT:_SetRoute(takeoff, _departure, _destination)
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
-- Fill table with waypoints.
|
-- Fill table with waypoints.
|
||||||
local waypoints={}
|
local waypoints={}
|
||||||
@ -2462,7 +2586,9 @@ end
|
|||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
function RAT:_SetStatus(group, status)
|
function RAT:_SetStatus(group, status)
|
||||||
local index=self:GetSpawnIndexFromGroup(group)
|
local index=self:GetSpawnIndexFromGroup(group)
|
||||||
env.info(RAT.id.."Status for group "..group:GetName()..": "..status)
|
local text=string.format("New status for group %s: %s",group:GetName(), status)
|
||||||
|
env.info(RAT.id..text)
|
||||||
|
MESSAGE:New(text, 180):ToAll()
|
||||||
self.ratcraft[index].status=status
|
self.ratcraft[index].status=status
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2491,8 +2617,10 @@ function RAT:_OnBirth(EventData)
|
|||||||
local status
|
local status
|
||||||
if SpawnGroup:InAir() then
|
if SpawnGroup:InAir() then
|
||||||
status="Just born (after air start)"
|
status="Just born (after air start)"
|
||||||
|
status=RAT.status.EventBirthAir
|
||||||
else
|
else
|
||||||
status="Starting engines (after birth)"
|
status="Starting engines (after birth)"
|
||||||
|
status=RAT.status.EventBirth
|
||||||
end
|
end
|
||||||
self:_SetStatus(SpawnGroup, status)
|
self:_SetStatus(SpawnGroup, status)
|
||||||
|
|
||||||
@ -2528,11 +2656,12 @@ function RAT:_EngineStartup(EventData)
|
|||||||
local status
|
local status
|
||||||
if SpawnGroup:InAir() then
|
if SpawnGroup:InAir() then
|
||||||
status="On journey (after air start)"
|
status="On journey (after air start)"
|
||||||
|
status=RAT.status.EventEngineStartAir
|
||||||
else
|
else
|
||||||
status="Taxiing (after engines started)"
|
status="Taxiing (after engines started)"
|
||||||
|
status=RAT.status.EventEngineStart
|
||||||
end
|
end
|
||||||
self:_SetStatus(SpawnGroup, status)
|
self:_SetStatus(SpawnGroup, status)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2563,7 +2692,9 @@ function RAT:_OnTakeoff(EventData)
|
|||||||
env.info(RAT.id..text)
|
env.info(RAT.id..text)
|
||||||
|
|
||||||
-- Set status.
|
-- Set status.
|
||||||
self:_SetStatus(SpawnGroup, "On journey (after takeoff)")
|
local status=RAT.status.EventTakeoff
|
||||||
|
--self:_SetStatus(SpawnGroup, "On journey (after takeoff)")
|
||||||
|
self:_SetStatus(SpawnGroup, status)
|
||||||
|
|
||||||
if self.respawn_after_takeoff then
|
if self.respawn_after_takeoff then
|
||||||
text="Event: Group "..SpawnGroup:GetName().." will be respawned."
|
text="Event: Group "..SpawnGroup:GetName().." will be respawned."
|
||||||
@ -2603,7 +2734,9 @@ function RAT:_OnLand(EventData)
|
|||||||
env.info(RAT.id..text)
|
env.info(RAT.id..text)
|
||||||
|
|
||||||
-- Set status.
|
-- Set status.
|
||||||
self:_SetStatus(SpawnGroup, "Taxiing (after landing)")
|
--self:_SetStatus(SpawnGroup, "Taxiing (after landing)")
|
||||||
|
local status=RAT.status.EventLand
|
||||||
|
self:_SetStatus(SpawnGroup, status)
|
||||||
|
|
||||||
-- ATC plane landed. Take it out of the queue and set runway to free.
|
-- ATC plane landed. Take it out of the queue and set runway to free.
|
||||||
if self.ATCswitch then
|
if self.ATCswitch then
|
||||||
@ -2648,7 +2781,9 @@ function RAT:_OnEngineShutdown(EventData)
|
|||||||
env.info(RAT.id..text)
|
env.info(RAT.id..text)
|
||||||
|
|
||||||
-- Set status.
|
-- Set status.
|
||||||
self:_SetStatus(SpawnGroup, "Parking (shutting down engines)")
|
--self:_SetStatus(SpawnGroup, "Parking (shutting down engines)")
|
||||||
|
local status=RAT.status.EventEngineShutdown
|
||||||
|
self:_SetStatus(SpawnGroup, status)
|
||||||
|
|
||||||
if not self.respawn_at_landing and not self.norespawn then
|
if not self.respawn_at_landing and not self.norespawn then
|
||||||
text="Event: Group "..SpawnGroup:GetName().." will be respawned."
|
text="Event: Group "..SpawnGroup:GetName().." will be respawned."
|
||||||
@ -2693,7 +2828,9 @@ function RAT:_OnDead(EventData)
|
|||||||
env.info(RAT.id..text)
|
env.info(RAT.id..text)
|
||||||
|
|
||||||
-- Set status.
|
-- Set status.
|
||||||
self:_SetStatus(SpawnGroup, "Destroyed (after dead)")
|
--self:_SetStatus(SpawnGroup, "Destroyed (after dead)")
|
||||||
|
local status=RAT.status.EventDead
|
||||||
|
self:_SetStatus(SpawnGroup, status)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2727,7 +2864,9 @@ function RAT:_OnCrash(EventData)
|
|||||||
env.info(RAT.id..text)
|
env.info(RAT.id..text)
|
||||||
|
|
||||||
-- Set status.
|
-- Set status.
|
||||||
self:_SetStatus(SpawnGroup, "Crashed")
|
--self:_SetStatus(SpawnGroup, "Crashed")
|
||||||
|
local status=RAT.status.EventCrash
|
||||||
|
self:_SetStatus(SpawnGroup, status)
|
||||||
|
|
||||||
--TODO: Aircraft are not respawned if they crash. Should they?
|
--TODO: Aircraft are not respawned if they crash. Should they?
|
||||||
|
|
||||||
@ -3091,20 +3230,34 @@ function RAT._WaypointFunction(group, rat, wp)
|
|||||||
env.info(RAT.id.."Waypointfunction for waypoint "..wp)
|
env.info(RAT.id.."Waypointfunction for waypoint "..wp)
|
||||||
env.info("Final waypoint index "..rat.wp_final)
|
env.info("Final waypoint index "..rat.wp_final)
|
||||||
|
|
||||||
|
-- Current time and Spawnindex.
|
||||||
local Tnow=timer.getTime()
|
local Tnow=timer.getTime()
|
||||||
local sdx=rat:GetSpawnIndexFromGroup(group)
|
local sdx=rat:GetSpawnIndexFromGroup(group)
|
||||||
|
|
||||||
|
-- Departure and destination names.
|
||||||
local departure=rat.ratcraft[sdx].departure:GetName()
|
local departure=rat.ratcraft[sdx].departure:GetName()
|
||||||
local destination=rat.ratcraft[sdx].departure:GetName()
|
local destination=rat.ratcraft[sdx].departure:GetName()
|
||||||
|
|
||||||
local text=string.format("Flight %s passing waypoint #%d %s (%s to %s).", group:GetName(), wp, rat.waypointdescriptions[wp], departure, destination)
|
-- Info on passing waypoint.
|
||||||
|
local text=string.format("Flight %s passing waypoint #%d %s.", group:GetName(), wp, rat.waypointdescriptions[wp])
|
||||||
env.info(RAT.id..text)
|
env.info(RAT.id..text)
|
||||||
MESSAGE:New(text, 180):ToAll()
|
MESSAGE:New(text, 180):ToAll()
|
||||||
|
|
||||||
|
-- Set status
|
||||||
|
local status=rat.waypointstatus[wp]
|
||||||
|
rat.ratcraft[sdx].status=status
|
||||||
|
|
||||||
|
-- Radio about the status update.
|
||||||
|
MESSAGE:New("Flight "..group:GetName().." status "..status, 180):ToAll()
|
||||||
|
|
||||||
if wp==rat.wp_holding then
|
if wp==rat.wp_holding then
|
||||||
MESSAGE:New("Flight "..group:GetName().." holding!", 360):ToAll()
|
|
||||||
|
-- Aircraft arrived at holding point
|
||||||
|
MESSAGE:New("Flight "..group:GetName().." holding near "..destination.."!", 180):ToAll()
|
||||||
|
|
||||||
|
-- Register aircraft at ATC.
|
||||||
if rat.ATCswitch then
|
if rat.ATCswitch then
|
||||||
rat:_ATCRegisterFlight(group:GetName(), Tnow)
|
rat:_ATCRegisterFlight(group:GetName(), Tnow)
|
||||||
rat.ratcraft[sdx].status="Holding"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3123,7 +3276,7 @@ function RAT._WaypointFunction(group, rat, wp)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Orbit at a specified position at a specified alititude with a specified speed.
|
--- Task function.
|
||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
-- @param #string FunctionString Name of the function to be called.
|
-- @param #string FunctionString Name of the function to be called.
|
||||||
function RAT:_TaskFunction(FunctionString, ... )
|
function RAT:_TaskFunction(FunctionString, ... )
|
||||||
@ -3164,8 +3317,10 @@ end
|
|||||||
|
|
||||||
--- Anticipated group name from alias and spawn index.
|
--- Anticipated group name from alias and spawn index.
|
||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
|
-- @param #number index Spawnindex of group if given or self.SpawnIndex+1 by default.
|
||||||
-- @return #string Name the group will get after it is spawned.
|
-- @return #string Name the group will get after it is spawned.
|
||||||
function RAT:_AnticipatedGroupName()
|
function RAT:_AnticipatedGroupName(index)
|
||||||
|
local index=index or self.SpawnIndex+1
|
||||||
return string.format("%s#%03d", self.alias, self.SpawnIndex+1)
|
return string.format("%s#%03d", self.alias, self.SpawnIndex+1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -4088,3 +4243,4 @@ function RAT:_ATCQueue()
|
|||||||
end
|
end
|
||||||
]]
|
]]
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ Functional/RAT.lua
|
|||||||
Functional/ZoneGoal.lua
|
Functional/ZoneGoal.lua
|
||||||
Functional/ZoneGoalCoalition.lua
|
Functional/ZoneGoalCoalition.lua
|
||||||
Functional/ZoneCaptureCoalition.lua
|
Functional/ZoneCaptureCoalition.lua
|
||||||
Functional/SuppressionFire.lua
|
Functional/SuppressiveFire.lua
|
||||||
|
|
||||||
AI/AI_Balancer.lua
|
AI/AI_Balancer.lua
|
||||||
AI/AI_A2A.lua
|
AI/AI_A2A.lua
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user