Static 2.2.6

This commit is contained in:
FlightControl_Master
2017-10-31 11:15:48 +01:00
parent cf28ccaea0
commit e95522f902
2 changed files with 59 additions and 52 deletions

View File

@@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' ) env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20171029_1956' ) env.info( 'Moose Generation Timestamp: 20171031_1115' )
--- Various routines --- Various routines
-- @module routines -- @module routines
@@ -37445,8 +37445,6 @@ end
-- @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.
-- @field #string parking_id String with a special parking ID for the aircraft. -- @field #string parking_id String with a special parking ID for the aircraft.
-- @field #number wp_final Index of the final waypoint.
-- @field #number wp_holding Index of the holding waypoint.
-- @field #boolean radio If true/false disables radio messages from the RAT groups. -- @field #boolean radio If true/false disables radio messages from the RAT groups.
-- @field #number frequency Radio frequency used by the RAT groups. -- @field #number frequency Radio frequency used by the RAT groups.
-- @field #string modulation Ratio modulation. Either "FM" or "AM". -- @field #string modulation Ratio modulation. Either "FM" or "AM".
@@ -37666,8 +37664,6 @@ RAT={
skill="High", -- Skill of AI. skill="High", -- Skill of AI.
ATCswitch=true, -- Enable ATC. ATCswitch=true, -- Enable ATC.
parking_id=nil, -- Specific parking ID when aircraft are spawned at airports. parking_id=nil, -- Specific parking ID when aircraft are spawned at airports.
wp_final=nil, -- Index of the final waypoint.
wp_holding=nil, -- Index of the holding waypoint.
radio=nil, -- If true/false disables radio messages from the RAT groups. radio=nil, -- If true/false disables radio messages from the RAT groups.
frequency=nil, -- Radio frequency used by the RAT groups. frequency=nil, -- Radio frequency used by the RAT groups.
modulation=nil, -- Ratio modulation. Either "FM" or "AM". modulation=nil, -- Ratio modulation. Either "FM" or "AM".
@@ -37784,7 +37780,7 @@ RAT.id="RAT | "
--- RAT version. --- RAT version.
-- @field #string version -- @field #string version
RAT.version="2.0.0" RAT.version="2.0.1"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -38059,15 +38055,6 @@ function RAT:_CheckConsistency()
end end
end end
-- Count destination airports and zones.
for _,name in pairs(self.destination_ports) do
if self:_AirportExists(name) then
self.Ndestination_Airports=self.Ndestination_Airports+1
elseif self:_ZoneExists(name) then
self.Ndestination_Zones=self.Ndestination_Zones+1
end
end
-- What can go wrong? -- What can go wrong?
-- Only zones but not takeoff air == > Enable takeoff air. -- Only zones but not takeoff air == > Enable takeoff air.
if self.Ndeparture_Zones>0 and self.takeoff~=RAT.wp.air then if self.Ndeparture_Zones>0 and self.takeoff~=RAT.wp.air then
@@ -38085,6 +38072,16 @@ function RAT:_CheckConsistency()
-- User has used SetDestination() -- User has used SetDestination()
if not self.random_destination then if not self.random_destination then
-- Count destination airports and zones.
for _,name in pairs(self.destination_ports) do
if self:_AirportExists(name) then
self.Ndestination_Airports=self.Ndestination_Airports+1
elseif self:_ZoneExists(name) then
self.Ndestination_Zones=self.Ndestination_Zones+1
end
end
-- One zone specified as destination ==> Enable destination zone. -- One zone specified as destination ==> Enable destination zone.
-- This does not apply to return zone because the destination is the zone and not the final destination which can be an airport. -- This does not apply to return zone because the destination is the zone and not the final destination which can be an airport.
if self.Ndestination_Zones>0 and self.landing~=RAT.wp.air and not self.returnzone then if self.Ndestination_Zones>0 and self.landing~=RAT.wp.air and not self.returnzone then
@@ -38770,12 +38767,6 @@ function RAT:_SpawnWithRoute(_departure, _destination, _takeoff, _landing, _live
local takeoff=self.takeoff local takeoff=self.takeoff
local landing=self.landing local landing=self.landing
-- Random choice between cold and hot.
if self.takeoff==RAT.wp.coldorhot then
local temp={RAT.wp.cold, RAT.wp.hot}
takeoff=temp[math.random(2)]
end
-- Overrule takeoff/landing by what comes in. -- Overrule takeoff/landing by what comes in.
if _takeoff then if _takeoff then
takeoff=_takeoff takeoff=_takeoff
@@ -38784,8 +38775,14 @@ function RAT:_SpawnWithRoute(_departure, _destination, _takeoff, _landing, _live
landing=_landing landing=_landing
end end
-- Random choice between cold and hot.
if takeoff==RAT.wp.coldorhot then
local temp={RAT.wp.cold, RAT.wp.hot}
takeoff=temp[math.random(2)]
end
-- Set flight plan. -- Set flight plan.
local departure, destination, waypoints = self:_SetRoute(takeoff, landing, _departure, _destination, _waypoint) local departure, destination, waypoints, WPholding, WPfinal = self:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
-- Return nil if we could not find a departure destination or waypoints -- Return nil if we could not find a departure destination or waypoints
if not (departure and destination and waypoints) then if not (departure and destination and waypoints) then
@@ -38869,6 +38866,8 @@ function RAT:_SpawnWithRoute(_departure, _destination, _takeoff, _landing, _live
-- Each aircraft gets its own takeoff type. -- Each aircraft gets its own takeoff type.
self.ratcraft[self.SpawnIndex].takeoff=takeoff self.ratcraft[self.SpawnIndex].takeoff=takeoff
self.ratcraft[self.SpawnIndex].landing=landing self.ratcraft[self.SpawnIndex].landing=landing
self.ratcraft[self.SpawnIndex].wpholding=WPholding
self.ratcraft[self.SpawnIndex].wpfinal=WPfinal
-- Livery -- Livery
self.ratcraft[self.SpawnIndex].livery=livery self.ratcraft[self.SpawnIndex].livery=livery
@@ -39100,7 +39099,6 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
-- Departure airport or zone. -- Departure airport or zone.
local departure=nil local departure=nil
if _departure then if _departure then
if self:_AirportExists(_departure) then if self:_AirportExists(_departure) then
-- Check if new departure is an airport. -- Check if new departure is an airport.
departure=AIRBASE:FindByName(_departure) departure=AIRBASE:FindByName(_departure)
@@ -39518,6 +39516,8 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
-- Waypoints and coordinates -- Waypoints and coordinates
local wp={} local wp={}
local c={} local c={}
local wpholding=nil
local wpfinal=nil
-- Departure/Take-off -- Departure/Take-off
c[#c+1]=Pdeparture c[#c+1]=Pdeparture
@@ -39615,7 +39615,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.holding, c[#wp+1], VxHolding, H_holding+h_holding) wp[#wp+1]=self:_Waypoint(#wp+1, RAT.wp.holding, c[#wp+1], VxHolding, H_holding+h_holding)
self.waypointdescriptions[#wp]="Holding Point" self.waypointdescriptions[#wp]="Holding Point"
self.waypointstatus[#wp]=RAT.status.Holding self.waypointstatus[#wp]=RAT.status.Holding
self.wp_holding=#wp wpholding=#wp
-- Final destination. -- Final destination.
c[#c+1]=Pdestination c[#c+1]=Pdestination
@@ -39626,7 +39626,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
end end
-- Final Waypoint -- Final Waypoint
self.wp_final=#wp wpfinal=#wp
-- Fill table with waypoints. -- Fill table with waypoints.
local waypoints={} local waypoints={}
@@ -39640,9 +39640,9 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
-- Return departure, destination and waypoints. -- Return departure, destination and waypoints.
if self.returnzone then if self.returnzone then
-- We return the actual zone here because returning the departure leads to problems with commute. -- We return the actual zone here because returning the departure leads to problems with commute.
return departure, destination_returnzone, waypoints return departure, destination_returnzone, waypoints, wpholding, wpfinal
else else
return departure, destination, waypoints return departure, destination, waypoints, wpholding, wpfinal
end end
end end
@@ -40793,6 +40793,9 @@ function RAT._WaypointFunction(group, rat, wp)
local departure=rat.ratcraft[sdx].departure:GetName() local departure=rat.ratcraft[sdx].departure:GetName()
local destination=rat.ratcraft[sdx].destination:GetName() local destination=rat.ratcraft[sdx].destination:GetName()
local landing=rat.ratcraft[sdx].landing local landing=rat.ratcraft[sdx].landing
local WPholding=rat.ratcraft[sdx].wpholding
local WPfinal=rat.ratcraft[sdx].wpfinal
-- For messages -- For messages
local text local text
@@ -40807,7 +40810,7 @@ function RAT._WaypointFunction(group, rat, wp)
--rat.ratcraft[sdx].status=status --rat.ratcraft[sdx].status=status
rat:_SetStatus(group, status) rat:_SetStatus(group, status)
if wp==rat.wp_holding then if wp==WPholding then
-- Aircraft arrived at holding point -- Aircraft arrived at holding point
text=string.format("Flight %s to %s ATC: Holding and awaiting landing clearance.", group:GetName(), destination) text=string.format("Flight %s to %s ATC: Holding and awaiting landing clearance.", group:GetName(), destination)
@@ -40820,7 +40823,7 @@ function RAT._WaypointFunction(group, rat, wp)
end end
end end
if wp==rat.wp_final then if wp==WPfinal then
text=string.format("Flight %s arrived at final destination %s.", group:GetName(), destination) text=string.format("Flight %s arrived at final destination %s.", group:GetName(), destination)
MESSAGE:New(text, 10):ToAllIf(rat.reportstatus) MESSAGE:New(text, 10):ToAllIf(rat.reportstatus)
env.info(RAT.id..text) env.info(RAT.id..text)

View File

@@ -1,5 +1,5 @@
env.info('*** MOOSE STATIC INCLUDE START *** ') env.info('*** MOOSE STATIC INCLUDE START *** ')
env.info('Moose Generation Timestamp: 20171029_1956') env.info('Moose Generation Timestamp: 20171031_1115')
env.setErrorMessageBoxEnabled(false) env.setErrorMessageBoxEnabled(false)
routines={} routines={}
routines.majorVersion=3 routines.majorVersion=3
@@ -18423,8 +18423,6 @@ livery=nil,
skill="High", skill="High",
ATCswitch=true, ATCswitch=true,
parking_id=nil, parking_id=nil,
wp_final=nil,
wp_holding=nil,
radio=nil, radio=nil,
frequency=nil, frequency=nil,
modulation=nil, modulation=nil,
@@ -18501,7 +18499,7 @@ delay=240,
RAT.markerid=0 RAT.markerid=0
RAT.MenuF10=nil RAT.MenuF10=nil
RAT.id="RAT | " RAT.id="RAT | "
RAT.version="2.0.0" RAT.version="2.0.1"
function RAT:New(groupname,alias) function RAT:New(groupname,alias)
env.info(RAT.id.."Version "..RAT.version) env.info(RAT.id.."Version "..RAT.version)
env.info(RAT.id.."Creating new RAT object from template: "..groupname) env.info(RAT.id.."Creating new RAT object from template: "..groupname)
@@ -18649,13 +18647,6 @@ elseif self:_ZoneExists(name)then
self.Ndeparture_Zones=self.Ndeparture_Zones+1 self.Ndeparture_Zones=self.Ndeparture_Zones+1
end end
end end
for _,name in pairs(self.destination_ports)do
if self:_AirportExists(name)then
self.Ndestination_Airports=self.Ndestination_Airports+1
elseif self:_ZoneExists(name)then
self.Ndestination_Zones=self.Ndestination_Zones+1
end
end
if self.Ndeparture_Zones>0 and self.takeoff~=RAT.wp.air then if self.Ndeparture_Zones>0 and self.takeoff~=RAT.wp.air then
self.takeoff=RAT.wp.air self.takeoff=RAT.wp.air
env.error(RAT.id.."At least one zone defined as departure and takeoff is NOT set to air. Enabling air start!") env.error(RAT.id.."At least one zone defined as departure and takeoff is NOT set to air. Enabling air start!")
@@ -18668,6 +18659,13 @@ MESSAGE:New(text,30):ToAll()
end end
end end
if not self.random_destination then if not self.random_destination then
for _,name in pairs(self.destination_ports)do
if self:_AirportExists(name)then
self.Ndestination_Airports=self.Ndestination_Airports+1
elseif self:_ZoneExists(name)then
self.Ndestination_Zones=self.Ndestination_Zones+1
end
end
if self.Ndestination_Zones>0 and self.landing~=RAT.wp.air and not self.returnzone then if self.Ndestination_Zones>0 and self.landing~=RAT.wp.air and not self.returnzone then
self.landing=RAT.wp.air self.landing=RAT.wp.air
self.destinationzone=true self.destinationzone=true
@@ -19041,17 +19039,17 @@ end
function RAT:_SpawnWithRoute(_departure,_destination,_takeoff,_landing,_livery,_waypoint) function RAT:_SpawnWithRoute(_departure,_destination,_takeoff,_landing,_livery,_waypoint)
local takeoff=self.takeoff local takeoff=self.takeoff
local landing=self.landing local landing=self.landing
if self.takeoff==RAT.wp.coldorhot then
local temp={RAT.wp.cold,RAT.wp.hot}
takeoff=temp[math.random(2)]
end
if _takeoff then if _takeoff then
takeoff=_takeoff takeoff=_takeoff
end end
if _landing then if _landing then
landing=_landing landing=_landing
end end
local departure,destination,waypoints=self:_SetRoute(takeoff,landing,_departure,_destination,_waypoint) if takeoff==RAT.wp.coldorhot then
local temp={RAT.wp.cold,RAT.wp.hot}
takeoff=temp[math.random(2)]
end
local departure,destination,waypoints,WPholding,WPfinal=self:_SetRoute(takeoff,landing,_departure,_destination,_waypoint)
if not(departure and destination and waypoints)then if not(departure and destination and waypoints)then
return nil return nil
end end
@@ -19101,6 +19099,8 @@ self.ratcraft[self.SpawnIndex]["Pnow"]=group:GetCoordinate()
self.ratcraft[self.SpawnIndex]["Distance"]=0 self.ratcraft[self.SpawnIndex]["Distance"]=0
self.ratcraft[self.SpawnIndex].takeoff=takeoff self.ratcraft[self.SpawnIndex].takeoff=takeoff
self.ratcraft[self.SpawnIndex].landing=landing self.ratcraft[self.SpawnIndex].landing=landing
self.ratcraft[self.SpawnIndex].wpholding=WPholding
self.ratcraft[self.SpawnIndex].wpfinal=WPfinal
self.ratcraft[self.SpawnIndex].livery=livery self.ratcraft[self.SpawnIndex].livery=livery
self.ratcraft[self.SpawnIndex].despawnme=false self.ratcraft[self.SpawnIndex].despawnme=false
if self.f10menu then if self.f10menu then
@@ -19502,6 +19502,8 @@ d_cruise=100
end end
local wp={} local wp={}
local c={} local c={}
local wpholding=nil
local wpfinal=nil
c[#c+1]=Pdeparture c[#c+1]=Pdeparture
wp[#wp+1]=self:_Waypoint(#wp+1,takeoff,c[#wp+1],VxClimb,H_departure,departure) wp[#wp+1]=self:_Waypoint(#wp+1,takeoff,c[#wp+1],VxClimb,H_departure,departure)
self.waypointdescriptions[#wp]="Departure" self.waypointdescriptions[#wp]="Departure"
@@ -19565,22 +19567,22 @@ c[#c+1]=Pholding
wp[#wp+1]=self:_Waypoint(#wp+1,RAT.wp.holding,c[#wp+1],VxHolding,H_holding+h_holding) wp[#wp+1]=self:_Waypoint(#wp+1,RAT.wp.holding,c[#wp+1],VxHolding,H_holding+h_holding)
self.waypointdescriptions[#wp]="Holding Point" self.waypointdescriptions[#wp]="Holding Point"
self.waypointstatus[#wp]=RAT.status.Holding self.waypointstatus[#wp]=RAT.status.Holding
self.wp_holding=#wp wpholding=#wp
c[#c+1]=Pdestination c[#c+1]=Pdestination
wp[#wp+1]=self:_Waypoint(#wp+1,landing,c[#wp+1],VxFinal,H_destination,destination) wp[#wp+1]=self:_Waypoint(#wp+1,landing,c[#wp+1],VxFinal,H_destination,destination)
self.waypointdescriptions[#wp]="Destination" self.waypointdescriptions[#wp]="Destination"
self.waypointstatus[#wp]=RAT.status.Destination self.waypointstatus[#wp]=RAT.status.Destination
end end
self.wp_final=#wp wpfinal=#wp
local waypoints={} local waypoints={}
for _,p in ipairs(wp)do for _,p in ipairs(wp)do
table.insert(waypoints,p) table.insert(waypoints,p)
end end
self:_Routeinfo(waypoints,"Waypoint info in set_route:") self:_Routeinfo(waypoints,"Waypoint info in set_route:")
if self.returnzone then if self.returnzone then
return departure,destination_returnzone,waypoints return departure,destination_returnzone,waypoints,wpholding,wpfinal
else else
return departure,destination,waypoints return departure,destination,waypoints,wpholding,wpfinal
end end
end end
function RAT:_PickDeparture(takeoff) function RAT:_PickDeparture(takeoff)
@@ -20298,12 +20300,14 @@ local sdx=rat:GetSpawnIndexFromGroup(group)
local departure=rat.ratcraft[sdx].departure:GetName() local departure=rat.ratcraft[sdx].departure:GetName()
local destination=rat.ratcraft[sdx].destination:GetName() local destination=rat.ratcraft[sdx].destination:GetName()
local landing=rat.ratcraft[sdx].landing local landing=rat.ratcraft[sdx].landing
local WPholding=rat.ratcraft[sdx].wpholding
local WPfinal=rat.ratcraft[sdx].wpfinal
local text local text
text=string.format("Flight %s passing waypoint #%d %s.",group:GetName(),wp,rat.waypointdescriptions[wp]) 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)
local status=rat.waypointstatus[wp] local status=rat.waypointstatus[wp]
rat:_SetStatus(group,status) rat:_SetStatus(group,status)
if wp==rat.wp_holding then if wp==WPholding then
text=string.format("Flight %s to %s ATC: Holding and awaiting landing clearance.",group:GetName(),destination) text=string.format("Flight %s to %s ATC: Holding and awaiting landing clearance.",group:GetName(),destination)
MESSAGE:New(text,10):ToAllIf(rat.reportstatus) MESSAGE:New(text,10):ToAllIf(rat.reportstatus)
if rat.ATCswitch then if rat.ATCswitch then
@@ -20311,7 +20315,7 @@ MENU_MISSION_COMMAND:New("Clear for landing",rat.Menu[rat.SubMenuName].groups[sd
rat:_ATCRegisterFlight(group:GetName(),Tnow) rat:_ATCRegisterFlight(group:GetName(),Tnow)
end end
end end
if wp==rat.wp_final then if wp==WPfinal then
text=string.format("Flight %s arrived at final destination %s.",group:GetName(),destination) text=string.format("Flight %s arrived at final destination %s.",group:GetName(),destination)
MESSAGE:New(text,10):ToAllIf(rat.reportstatus) MESSAGE:New(text,10):ToAllIf(rat.reportstatus)
env.info(RAT.id..text) env.info(RAT.id..text)