mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'FF/Ops' into FF/OpsDev
This commit is contained in:
commit
0531b8f57e
@ -32,6 +32,7 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/MarkerOps_Base.lua' )
|
|||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/TextAndSound.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/TextAndSound.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Pathline.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Pathline.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/ClientMenu.lua')
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/ClientMenu.lua')
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Vector.lua')
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Object.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Object.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Identifiable.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Identifiable.lua' )
|
||||||
@ -186,7 +187,7 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Dispatcher
|
|||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Zone.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Zone.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Dispatcher.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Dispatcher.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Vector.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Navigation/Beacons.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Navigation/Point.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Navigation/Point.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Navigation/Procedure.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Navigation/Procedure.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Navigation/FlightPlan.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Navigation/FlightPlan.lua' )
|
||||||
|
|||||||
@ -32,6 +32,7 @@ __Moose.Include( 'Core\\MarkerOps_Base.lua' )
|
|||||||
__Moose.Include( 'Core\\TextAndSound.lua' )
|
__Moose.Include( 'Core\\TextAndSound.lua' )
|
||||||
__Moose.Include( 'Core\\Condition.lua' )
|
__Moose.Include( 'Core\\Condition.lua' )
|
||||||
__Moose.Include( 'Core\\ClientMenu.lua' )
|
__Moose.Include( 'Core\\ClientMenu.lua' )
|
||||||
|
__Moose.Include( 'Core\\Vector.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Wrapper\\Object.lua' )
|
__Moose.Include( 'Wrapper\\Object.lua' )
|
||||||
__Moose.Include( 'Wrapper\\Identifiable.lua' )
|
__Moose.Include( 'Wrapper\\Identifiable.lua' )
|
||||||
@ -178,4 +179,7 @@ __Moose.Include( 'Tasking\\Task_Cargo_Dispatcher.lua' )
|
|||||||
__Moose.Include( 'Tasking\\Task_Capture_Zone.lua' )
|
__Moose.Include( 'Tasking\\Task_Capture_Zone.lua' )
|
||||||
__Moose.Include( 'Tasking\\Task_Capture_Dispatcher.lua' )
|
__Moose.Include( 'Tasking\\Task_Capture_Dispatcher.lua' )
|
||||||
|
|
||||||
|
__Moose.Include( 'Navigation\\Point.lua' )
|
||||||
|
__Moose.Include( 'Navigation\\Beacons.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Globals.lua' )
|
__Moose.Include( 'Globals.lua' )
|
||||||
|
|||||||
139
Moose Development/Moose/Navigation/Beacons.lua
Normal file
139
Moose Development/Moose/Navigation/Beacons.lua
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
--- **NAVIGATION** - Beacons of the map/theatre.
|
||||||
|
--
|
||||||
|
-- **Main Features:**
|
||||||
|
--
|
||||||
|
-- * Beacons of the map
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ## Example Missions:
|
||||||
|
--
|
||||||
|
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Navigation%20-%20Beacons).
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ### Author: **funkyfranky**
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
-- @module Navigation.Beacons
|
||||||
|
-- @image NAVIGATION_Beacons.png
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- BEACONS class.
|
||||||
|
-- @type BEACONS
|
||||||
|
--
|
||||||
|
-- @field #string ClassName Name of the class.
|
||||||
|
-- @field #number verbose Verbosity of output.
|
||||||
|
-- @field #table beacons Beacons.
|
||||||
|
--
|
||||||
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
--- *A fleet of British ships at war are the best negotiators.* -- Horatio Nelson
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- # The BEACONS Concept
|
||||||
|
--
|
||||||
|
-- The NAVFIX class has a great concept!
|
||||||
|
--
|
||||||
|
-- Bla, bla...
|
||||||
|
--
|
||||||
|
-- # Basic Setup
|
||||||
|
--
|
||||||
|
-- A new `BEACONS` object can be created with the @{#BEACONS.New}() function.
|
||||||
|
--
|
||||||
|
-- local beacons=BEACONS:New("G:\Games\DCS World Testing\Mods\terrains\GermanyColdWar\beacons.lua")
|
||||||
|
--
|
||||||
|
-- This is how it works.
|
||||||
|
--
|
||||||
|
-- @field #BEACONS
|
||||||
|
BEACONS = {
|
||||||
|
ClassName = "BEACONS",
|
||||||
|
verbose = 0,
|
||||||
|
beacons = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
--- BEACONS class version.
|
||||||
|
-- @field #string version
|
||||||
|
BEACONS.version="0.0.0"
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- ToDo list
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- TODO: A lot...
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Constructor(s)
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Create a new BECAONS class instance from a given file.
|
||||||
|
-- @param #BEACONS self
|
||||||
|
-- @param #string FileName Full path to the file containing the map beacons.
|
||||||
|
-- @return #BEACONS self
|
||||||
|
function BEACONS:NewFromFile(FileName)
|
||||||
|
|
||||||
|
-- Inherit everything from BASE class.
|
||||||
|
self=BASE:Inherit(self, BASE:New()) -- #BEACONS
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- User Functions
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Add marker all beacons on the F10 map.
|
||||||
|
-- @param #BEACONS self
|
||||||
|
-- @return #BEACONS self
|
||||||
|
function BEACONS:MarkerShow()
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Remove markers of all beacons from the F10 map.
|
||||||
|
-- @param #BEACONS self
|
||||||
|
-- @return #BEACONS self
|
||||||
|
function BEACONS:MarkerRemove()
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Private Functions
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Get text displayed in the F10 marker.
|
||||||
|
-- @param #BEACONS self
|
||||||
|
-- @return #string Marker text.
|
||||||
|
function BEACONS:_GetMarkerText(beacon)
|
||||||
|
|
||||||
|
local altmin=self.altMin and tostring(self.altMin) or ""
|
||||||
|
local altmax=self.altMax and tostring(self.altMax) or ""
|
||||||
|
local speedmin=self.speedMin and tostring(self.speedMin) or ""
|
||||||
|
local speedmax=self.speedMax and tostring(self.speedMax) or ""
|
||||||
|
|
||||||
|
|
||||||
|
local text=string.format("NAVFIX %s", self.name)
|
||||||
|
if self.isIAF then
|
||||||
|
text=text..string.format(" (IAF)")
|
||||||
|
end
|
||||||
|
if self.isIF then
|
||||||
|
text=text..string.format(" (IF)")
|
||||||
|
end
|
||||||
|
text=text..string.format("\nAltitude [ft]: %s - %s", altmin, altmax)
|
||||||
|
text=text..string.format("\nSpeed [knots]: %s - %s", speedmin, speedmax)
|
||||||
|
text=text..string.format("\nCompulsory: %s", tostring(self.isCompulsory))
|
||||||
|
text=text..string.format("\nFly Over: %s", tostring(self.isFlyover))
|
||||||
|
|
||||||
|
return text
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -599,7 +599,80 @@ function BRIGADE:onafterStatus(From, Event, To)
|
|||||||
text=text..string.format("\n* %s: spawned=%s", asset.spawngroupname, tostring(asset.spawned))
|
text=text..string.format("\n* %s: spawned=%s", asset.spawngroupname, tostring(asset.spawned))
|
||||||
end
|
end
|
||||||
self:I(self.lid..text)
|
self:I(self.lid..text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.verbose>=3 then
|
||||||
|
|
||||||
|
-- Count numbers
|
||||||
|
local Ntotal=0
|
||||||
|
local Nspawned=0
|
||||||
|
local Nrequested=0
|
||||||
|
local Nreserved=0
|
||||||
|
local Nstock=0
|
||||||
|
|
||||||
|
local text="\n===========================================\n"
|
||||||
|
text=text.."Assets:"
|
||||||
|
local legion=self --Ops.Legion#LEGION
|
||||||
|
|
||||||
|
for _,_cohort in pairs(legion.cohorts) do
|
||||||
|
local cohort=_cohort --Ops.Cohort#COHORT
|
||||||
|
|
||||||
|
for _,_asset in pairs(cohort.assets) do
|
||||||
|
local asset=_asset --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||||
|
|
||||||
|
local state="In Stock"
|
||||||
|
if asset.flightgroup then
|
||||||
|
state=asset.flightgroup:GetState()
|
||||||
|
local mission=legion:GetAssetCurrentMission(asset)
|
||||||
|
if mission then
|
||||||
|
state=state..string.format(", Mission \"%s\" [%s]", mission:GetName(), mission:GetType())
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if asset.spawned then
|
||||||
|
env.info("FF ERROR: asset has opsgroup but is NOT spawned!")
|
||||||
|
end
|
||||||
|
if asset.requested and asset.isReserved then
|
||||||
|
env.info("FF ERROR: asset is requested and reserved. Should not be both!")
|
||||||
|
state="Reserved+Requested!"
|
||||||
|
elseif asset.isReserved then
|
||||||
|
state="Reserved"
|
||||||
|
elseif asset.requested then
|
||||||
|
state="Requested"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Text.
|
||||||
|
text=text..string.format("\n[UID=%03d] %s Legion=%s [%s]: State=%s [RID=%s]",
|
||||||
|
asset.uid, asset.spawngroupname, legion.alias, cohort.name, state, tostring(asset.rid))
|
||||||
|
|
||||||
|
|
||||||
|
if asset.spawned then
|
||||||
|
Nspawned=Nspawned+1
|
||||||
|
end
|
||||||
|
if asset.requested then
|
||||||
|
Nrequested=Nrequested+1
|
||||||
|
end
|
||||||
|
if asset.isReserved then
|
||||||
|
Nreserved=Nreserved+1
|
||||||
|
end
|
||||||
|
if not (asset.spawned or asset.requested or asset.isReserved) then
|
||||||
|
Nstock=Nstock+1
|
||||||
|
end
|
||||||
|
|
||||||
|
Ntotal=Ntotal+1
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
text=text.."\n-------------------------------------------"
|
||||||
|
text=text..string.format("\nNstock = %d", Nstock)
|
||||||
|
text=text..string.format("\nNreserved = %d", Nreserved)
|
||||||
|
text=text..string.format("\nNrequested = %d", Nrequested)
|
||||||
|
text=text..string.format("\nNspawned = %d", Nspawned)
|
||||||
|
text=text..string.format("\nNtotal = %d (=%d)", Ntotal, Nstock+Nspawned+Nrequested+Nreserved)
|
||||||
|
text=text.."\n==========================================="
|
||||||
|
self:I(self.lid..text)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user