Merge remote-tracking branch 'origin/master' into develop

# Conflicts:
#	Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
#	Moose Development/Moose/AI/AI_A2G_Dispatcher.lua
#	Moose Development/Moose/AI/AI_CAP.lua
#	Moose Development/Moose/AI/AI_CAS.lua
#	Moose Development/Moose/AI/AI_Patrol.lua
#	Moose Development/Moose/Core/Base.lua
#	Moose Development/Moose/Core/Beacon.lua
#	Moose Development/Moose/Core/Database.lua
#	Moose Development/Moose/Core/Fsm.lua
#	Moose Development/Moose/Core/MarkerOps_Base.lua
#	Moose Development/Moose/Core/Menu.lua
#	Moose Development/Moose/Core/Message.lua
#	Moose Development/Moose/Core/Point.lua
#	Moose Development/Moose/Core/ScheduleDispatcher.lua
#	Moose Development/Moose/Core/Scheduler.lua
#	Moose Development/Moose/Core/Set.lua
#	Moose Development/Moose/Core/Spawn.lua
#	Moose Development/Moose/Core/Zone.lua
#	Moose Development/Moose/DCS.lua
#	Moose Development/Moose/Functional/Detection.lua
#	Moose Development/Moose/Functional/Mantis.lua
#	Moose Development/Moose/Functional/Range.lua
#	Moose Development/Moose/Functional/Scoring.lua
#	Moose Development/Moose/Functional/Sead.lua
#	Moose Development/Moose/Modules.lua
#	Moose Development/Moose/Ops/ATIS.lua
#	Moose Development/Moose/Ops/Airboss.lua
#	Moose Development/Moose/Sound/UserSound.lua
#	Moose Development/Moose/Utilities/Enums.lua
#	Moose Development/Moose/Utilities/FiFo.lua
#	Moose Development/Moose/Utilities/Profiler.lua
#	Moose Development/Moose/Utilities/Routines.lua
#	Moose Development/Moose/Utilities/STTS.lua
#	Moose Development/Moose/Utilities/Utils.lua
#	Moose Development/Moose/Wrapper/Airbase.lua
#	Moose Development/Moose/Wrapper/Controllable.lua
#	Moose Development/Moose/Wrapper/Group.lua
#	Moose Development/Moose/Wrapper/Marker.lua
#	Moose Development/Moose/Wrapper/Positionable.lua
#	Moose Development/Moose/Wrapper/Unit.lua
#	Moose Setup/Moose.files
This commit is contained in:
Applevangelist
2022-09-06 09:53:22 +02:00
parent bf3ee93c23
commit 8cceee49ea
59 changed files with 8939 additions and 9472 deletions

View File

@@ -54,7 +54,7 @@
-- * @{#AIRBASE.Find}(): Find a AIRBASE instance from the _DATABASE object using a DCS Airbase object.
-- * @{#AIRBASE.FindByName}(): Find a AIRBASE instance from the _DATABASE object using a DCS Airbase name.
--
-- IMPORTANT: ONE SHOULD NEVER SANATIZE these AIRBASE OBJECT REFERENCES! (make the AIRBASE object references nil).
-- IMPORTANT: ONE SHOULD NEVER SANITIZE these AIRBASE OBJECT REFERENCES! (make the AIRBASE object references nil).
--
-- ## DCS Airbase APIs
--
@@ -65,13 +65,14 @@
--
-- @field #AIRBASE AIRBASE
AIRBASE = {
ClassName="AIRBASE",
ClassName = "AIRBASE",
CategoryName = {
[Airbase.Category.AIRDROME] = "Airdrome",
[Airbase.Category.HELIPAD] = "Helipad",
[Airbase.Category.SHIP] = "Ship",
},
}
[Airbase.Category.AIRDROME] = "Airdrome",
[Airbase.Category.HELIPAD] = "Helipad",
[Airbase.Category.SHIP] = "Ship",
},
activerwyno = nil,
}
--- Enumeration to identify the airbases in the Caucasus region.
--
@@ -122,7 +123,7 @@ AIRBASE.Caucasus = {
["Nalchik"] = "Nalchik",
["Mozdok"] = "Mozdok",
["Beslan"] = "Beslan",
}
}
--- Airbases of the Nevada map:
--
@@ -163,7 +164,7 @@ AIRBASE.Nevada = {
["Pahute_Mesa_Airstrip"] = "Pahute Mesa",
["Tonopah_Airport"] = "Tonopah",
["Tonopah_Test_Range_Airfield"] = "Tonopah Test Range",
}
}
--- Airbases of the Normandy map:
--
@@ -198,7 +199,7 @@ AIRBASE.Nevada = {
-- * AIRBASE.Normandy.Funtington
-- * AIRBASE.Normandy.Tangmere
-- * AIRBASE.Normandy.Ford_AF
--
--
-- @field Normandy
AIRBASE.Normandy = {
["Saint_Pierre_du_Mont"] = "Saint Pierre du Mont",
@@ -272,7 +273,7 @@ AIRBASE.Normandy = {
-- * AIRBASE.PersianGulf.Sirri_Island
-- * AIRBASE.PersianGulf.Tunb_Island_AFB
-- * AIRBASE.PersianGulf.Tunb_Kochak
--
--
-- @field PersianGulf
AIRBASE.PersianGulf = {
["Abu_Dhabi_International_Airport"] = "Abu Dhabi Intl",
@@ -320,7 +321,7 @@ AIRBASE.PersianGulf = {
-- * AIRBASE.TheChannel.Biggin_Hill
-- * AIRBASE.TheChannel.Eastchurch
-- * AIRBASE.TheChannel.Headcorn
--
--
-- @field TheChannel
AIRBASE.TheChannel = {
["Abbeville_Drucat"] = "Abbeville Drucat",
@@ -466,7 +467,7 @@ AIRBASE.Syria={
["Ruwayshid"]="Ruwayshid",
["Sanliurfa"]="Sanliurfa",
["Tal_Siman"]="Tal Siman",
["Deir_ez_Zor"] = "Deir ez-Zor",
["Deir_ez_Zor"] = "Deir ez-Zor",
}
--- Airbases of the Mariana Islands map:
@@ -478,14 +479,14 @@ AIRBASE.Syria={
-- * AIRBASE.MarianaIslands.Tinian_Intl
-- * AIRBASE.MarianaIslands.Olf_Orote
--
--@field MarianaIslands
AIRBASE.MarianaIslands={
["Rota_Intl"]="Rota Intl",
["Andersen_AFB"]="Andersen AFB",
["Antonio_B_Won_Pat_Intl"]="Antonio B. Won Pat Intl",
["Saipan_Intl"]="Saipan Intl",
["Tinian_Intl"]="Tinian Intl",
["Olf_Orote"]="Olf Orote",
-- @field MarianaIslands
AIRBASE.MarianaIslands = {
["Rota_Intl"] = "Rota Intl",
["Andersen_AFB"] = "Andersen AFB",
["Antonio_B_Won_Pat_Intl"] = "Antonio B. Won Pat Intl",
["Saipan_Intl"] = "Saipan Intl",
["Tinian_Intl"] = "Tinian Intl",
["Olf_Orote"] = "Olf Orote",
}
--- Airbases of the South Atlantic map:

File diff suppressed because it is too large Load Diff

View File

@@ -571,7 +571,7 @@ function GROUP:GetSpeedMax()
local Units=self:GetUnits()
local speedmax=nil
local speedmax=0
for _,unit in pairs(Units) do
local unit=unit --Wrapper.Unit#UNIT
@@ -725,6 +725,30 @@ function GROUP:GetUnit( UnitNumber )
end
--- Check if an (air) group is a client or player slot. Information is retrieved from the group template.
-- @param #GROUP self
-- @return #boolean If true, group is associated with a client or player slot.
function GROUP:IsPlayer()
-- Get group.
-- local group=self:GetGroup()
-- Units of template group.
local units=self:GetTemplate().units
-- Get numbers.
for _,unit in pairs(units) do
-- Check if unit name matach and skill is Client or Player.
if unit.name==self:GetName() and (unit.skill=="Client" or unit.skill=="Player") then
return true
end
end
return false
end
--- Returns the DCS Unit with number UnitNumber.
-- If the underlying DCS Unit does not exist, the method will return nil. .
-- @param #GROUP self
@@ -732,11 +756,24 @@ end
-- @return DCS#Unit The DCS Unit.
function GROUP:GetDCSUnit( UnitNumber )
local DCSGroup=self:GetDCSObject()
local DCSGroup = self:GetDCSObject()
if DCSGroup then
local DCSUnitFound=DCSGroup:getUnit( UnitNumber )
return DCSUnitFound
if DCSGroup.getUnit and DCSGroup:getUnit( UnitNumber ) then
return DCSGroup:getUnit( UnitNumber )
else
local UnitFound = nil
-- 2.7.1 dead event bug, return the first alive unit instead
local units = DCSGroup:getUnits() or {}
for _,_unit in pairs(units) do
if _unit and _unit:isExist() then
return _unit
end
end
end
end
return nil
@@ -1083,8 +1120,7 @@ function GROUP:GetCoordinate()
end
end
BASE:E( { "Cannot GetCoordinate", Group = self, Alive = self:IsAlive() } )
return nil
end
@@ -1116,6 +1152,8 @@ end
function GROUP:GetHeading()
self:F2(self.GroupName)
self:F2(self.GroupName)
local GroupSize = self:GetSize()
local HeadingAccumulator = 0
local n=0

View File

@@ -171,7 +171,7 @@ function IDENTIFIABLE:GetCoalitionName()
if DCSIdentifiable then
-- Get coaliton ID.
-- Get coalition ID.
local IdentifiableCoalition = DCSIdentifiable:getCoalition()
self:T3( IdentifiableCoalition )

View File

@@ -15,7 +15,6 @@
-- @module Wrapper.Marker
-- @image MOOSE_Core.JPG
--- Marker class.
-- @type MARKER
-- @field #string ClassName Name of the class.
@@ -24,7 +23,7 @@
-- @field #number mid Marker ID.
-- @field Core.Point#COORDINATE coordinate Coordinate of the mark.
-- @field #string text Text displayed in the mark panel.
-- @field #string message Message dispayed when the mark is added.
-- @field #string message Message displayed when the mark is added.
-- @field #boolean readonly Marker is read-only.
-- @field #number coalition Coalition to which the marker is displayed.
-- @extends Core.Fsm#FSM
@@ -42,29 +41,29 @@
-- # Create a Marker
--
-- -- Create a MARKER object at Batumi with a trivial text.
-- local Coordinate=AIRBASE:FindByName("Batumi"):GetCoordinate()
-- mymarker=MARKER:New(Coordinate, "I am Batumi Airfield")
-- local Coordinate = AIRBASE:FindByName( "Batumi" ):GetCoordinate()
-- mymarker = MARKER:New( Coordinate, "I am Batumi Airfield" )
--
-- Now this does **not** show the marker yet. We still need to specifiy to whom it is shown. There are several options, i.e.
-- show the marker to everyone, to a speficic coaliton only, or only to a specific group.
-- Now this does **not** show the marker yet. We still need to specify to whom it is shown. There are several options, i.e.
-- show the marker to everyone, to a specific coalition only, or only to a specific group.
--
-- ## For Everyone
--
-- If the marker should be visible to everyone, you can use the :ToAll() function.
--
-- mymarker=MARKER:New(Coordinate, "I am Batumi Airfield"):ToAll()
-- mymarker = MARKER:New( Coordinate, "I am Batumi Airfield" ):ToAll()
--
-- ## For a Coaliton
-- ## For a Coalition
--
-- If the maker should be visible to a specific coalition, you can use the :ToCoalition() function.
--
-- mymarker=MARKER:New(Coordinate, "I am Batumi Airfield"):ToCoaliton(coaliton.side.BLUE)
-- mymarker = MARKER:New( Coordinate , "I am Batumi Airfield" ):ToCoalition( coalition.side.BLUE )
--
-- ### To Blue Coaliton
-- ### To Blue Coalition
--
-- ### To Red Coalition
--
-- This would show the marker only to the Blue coaliton.
-- This would show the marker only to the Blue coalition.
--
-- ## For a Group
--
@@ -76,28 +75,28 @@
--
-- The marker text and coordinate can be updated easily as shown below.
--
-- However, note that **updateing involves to remove and recreate the marker if either text or its coordinate is changed**.
-- However, note that **updating involves to remove and recreate the marker if either text or its coordinate is changed**.
-- *This is a DCS scripting engine limitation.*
--
-- ## Update Text
--
-- If you created a marker "mymarker" as shown above, you can update the dispayed test by
-- If you created a marker "mymarker" as shown above, you can update the displayed test by
--
-- mymarker:UpdateText("I am the new text at Batumi")
-- mymarker:UpdateText( "I am the new text at Batumi" )
--
-- The update can also be delayed by, e.g. 90 seconds, using
--
-- mymarker:UpdateText("I am the new text at Batumi", 90)
-- mymarker:UpdateText( "I am the new text at Batumi", 90 )
--
-- ## Update Coordinate
--
-- If you created a marker "mymarker" as shown above, you can update its coordinate on the F10 map by
--
-- mymarker:UpdateCoordinate(NewCoordinate)
-- mymarker:UpdateCoordinate( NewCoordinate )
--
-- The update can also be delayed by, e.g. 60 seconds, using
--
-- mymarker:UpdateCoordinate(NewCoordinate, 60)
-- mymarker:UpdateCoordinate( NewCoordinate , 60 )
--
-- # Retrieve Data
--
@@ -105,18 +104,18 @@
--
-- ## Text
--
-- local text=mymarker:GetText()
-- env.info("Marker Text = " .. text)
-- local text =mymarker:GetText()
-- env.info( "Marker Text = " .. text )
--
-- ## Coordinate
--
-- local Coordinate=mymarker:GetCoordinate()
-- env.info("Marker Coordinate LL DSM = " .. Coordinate:ToStringLLDMS())
-- local Coordinate = mymarker:GetCoordinate()
-- env.info( "Marker Coordinate LL DSM = " .. Coordinate:ToStringLLDMS() )
--
--
-- # FSM Events
--
-- Moose creates addditonal events, so called FSM event, when markers are added, changed, removed, and text or the coordianteis updated.
-- Moose creates additional events, so called FSM event, when markers are added, changed, removed, and text or the coordinate is updated.
--
-- These events can be captured and used for processing via OnAfter functions as shown below.
--
@@ -133,22 +132,21 @@
--
-- # Examples
--
--
-- @field #MARKER
MARKER = {
ClassName = "MARKER",
Debug = false,
lid = nil,
mid = nil,
coordinate = nil,
text = nil,
message = nil,
readonly = nil,
coalition = nil,
ClassName = "MARKER",
Debug = false,
lid = nil,
mid = nil,
coordinate = nil,
text = nil,
message = nil,
readonly = nil,
coalition = nil,
}
--- Marker ID. Running number.
_MARKERID=0
_MARKERID = 0
--- Marker class version.
-- @field #string version
@@ -172,38 +170,40 @@ MARKER.version="0.1.1"
-- @param Core.Point#COORDINATE Coordinate Coordinate where to place the marker.
-- @param #string Text Text displayed on the mark panel.
-- @return #MARKER self
function MARKER:New(Coordinate, Text)
function MARKER:New( Coordinate, Text )
-- Inherit everything from FSM class.
local self = BASE:Inherit( self, FSM:New() ) -- #MARKER
local self=BASE:Inherit(self, FSM:New()) -- #MARKER
self.coordinate=UTILS.DeepCopy(Coordinate)
self.text=Text
self.text = Text
-- Defaults
self.readonly=false
self.message=""
self.readonly = false
self.message = ""
-- New marker ID. This is not the one of the actual marker.
_MARKERID=_MARKERID+1
_MARKERID = _MARKERID + 1
self.myid=_MARKERID
self.myid = _MARKERID
-- Log ID.
self.lid=string.format("Marker #%d | ", self.myid)
self.lid = string.format( "Marker #%d | ", self.myid )
-- Start State.
self:SetStartState("Invisible")
self:SetStartState( "Invisible" )
-- Add FSM transitions.
-- From State --> Event --> To State
self:AddTransition("Invisible", "Added", "Visible") -- Marker was added.
self:AddTransition("Visible", "Removed", "Invisible") -- Marker was removed.
self:AddTransition("*", "Changed", "*") -- Marker was changed.
self:AddTransition( "Invisible", "Added", "Visible" ) -- Marker was added.
self:AddTransition( "Visible", "Removed", "Invisible" ) -- Marker was removed.
self:AddTransition( "*", "Changed", "*" ) -- Marker was changed.
self:AddTransition("*", "TextUpdate", "*") -- Text updated.
self:AddTransition("*", "CoordUpdate", "*") -- Coordinates updated.
self:AddTransition( "*", "TextUpdate", "*" ) -- Text updated.
self:AddTransition( "*", "CoordUpdate", "*" ) -- Coordinates updated.
--- Triggers the FSM event "Added".
-- @function [parent=#MARKER] Added
@@ -223,7 +223,6 @@ function MARKER:New(Coordinate, Text)
-- @param #string To To state.
-- @param Core.Event#EVENTDATA EventData Event data table.
--- Triggers the FSM event "Removed".
-- @function [parent=#MARKER] Removed
-- @param #MARKER self
@@ -242,7 +241,6 @@ function MARKER:New(Coordinate, Text)
-- @param #string To To state.
-- @param Core.Event#EVENTDATA EventData Event data table.
--- Triggers the FSM event "Changed".
-- @function [parent=#MARKER] Changed
-- @param #MARKER self
@@ -261,7 +259,6 @@ function MARKER:New(Coordinate, Text)
-- @param #string To To state.
-- @param Core.Event#EVENTDATA EventData Event data table.
--- Triggers the FSM event "TextUpdate".
-- @function [parent=#MARKER] TextUpdate
-- @param #MARKER self
@@ -280,7 +277,6 @@ function MARKER:New(Coordinate, Text)
-- @param #string To To state.
-- @param #string Text The new text.
--- Triggers the FSM event "CoordUpdate".
-- @function [parent=#MARKER] CoordUpdate
-- @param #MARKER self
@@ -299,11 +295,10 @@ function MARKER:New(Coordinate, Text)
-- @param #string To To state.
-- @param Core.Point#COORDINATE Coordinate The updated Coordinate.
-- Handle events.
self:HandleEvent(EVENTS.MarkAdded)
self:HandleEvent(EVENTS.MarkRemoved)
self:HandleEvent(EVENTS.MarkChange)
self:HandleEvent( EVENTS.MarkAdded )
self:HandleEvent( EVENTS.MarkRemoved )
self:HandleEvent( EVENTS.MarkChange )
return self
end
@@ -317,7 +312,7 @@ end
-- @return #MARKER self
function MARKER:ReadOnly()
self.readonly=true
self.readonly = true
return self
end
@@ -336,9 +331,9 @@ end
-- @param #MARKER self
-- @param #string Text Message displayed when the marker is added.
-- @return #MARKER self
function MARKER:Message(Text)
function MARKER:Message( Text )
self.message=Text or ""
self.message = Text or ""
return self
end
@@ -347,28 +342,28 @@ end
-- @param #MARKER self
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:ToAll(Delay)
function MARKER:ToAll( Delay )
if Delay and Delay>0 then
self:ScheduleOnce(Delay, MARKER.ToAll, self)
if Delay and Delay > 0 then
self:ScheduleOnce( Delay, MARKER.ToAll, self )
else
self.toall=true
self.tocoaliton=nil
self.coalition=nil
self.togroup=nil
self.groupname=nil
self.groupid=nil
self.toall = true
self.tocoalition = nil
self.coalition = nil
self.togroup = nil
self.groupname = nil
self.groupid = nil
-- First remove an existing mark.
if self.shown then
self:Remove()
end
self.mid=UTILS.GetMarkID()
self.mid = UTILS.GetMarkID()
-- Call DCS function.
trigger.action.markToAll(self.mid, self.text, self.coordinate:GetVec3(), self.readonly, self.message)
trigger.action.markToAll( self.mid, self.text, self.coordinate:GetVec3(), self.readonly, self.message )
end
@@ -377,32 +372,32 @@ end
--- Place marker visible for a specific coalition only.
-- @param #MARKER self
-- @param #number Coalition Coalition 1=Red, 2=Blue, 0=Neutral. See `coaliton.side.RED`.
-- @param #number Coalition Coalition 1=Red, 2=Blue, 0=Neutral. See `coalition.side.RED`.
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:ToCoalition(Coalition, Delay)
function MARKER:ToCoalition( Coalition, Delay )
if Delay and Delay>0 then
self:ScheduleOnce(Delay, MARKER.ToCoalition, self, Coalition)
if Delay and Delay > 0 then
self:ScheduleOnce( Delay, MARKER.ToCoalition, self, Coalition )
else
self.coalition=Coalition
self.coalition = Coalition
self.tocoaliton=true
self.toall=false
self.togroup=false
self.groupname=nil
self.groupid=nil
self.tocoalition = true
self.toall = false
self.togroup = false
self.groupname = nil
self.groupid = nil
-- First remove an existing mark.
if self.shown then
self:Remove()
end
self.mid=UTILS.GetMarkID()
self.mid = UTILS.GetMarkID()
-- Call DCS function.
trigger.action.markToCoalition(self.mid, self.text, self.coordinate:GetVec3(), self.coalition, self.readonly, self.message)
trigger.action.markToCoalition( self.mid, self.text, self.coordinate:GetVec3(), self.coalition, self.readonly, self.message )
end
@@ -413,8 +408,8 @@ end
-- @param #MARKER self
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:ToBlue(Delay)
self:ToCoalition(coalition.side.BLUE, Delay)
function MARKER:ToBlue( Delay )
self:ToCoalition( coalition.side.BLUE, Delay )
return self
end
@@ -422,8 +417,8 @@ end
-- @param #MARKER self
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:ToRed(Delay)
self:ToCoalition(coalition.side.RED, Delay)
function MARKER:ToRed( Delay )
self:ToCoalition( coalition.side.RED, Delay )
return self
end
@@ -431,51 +426,50 @@ end
-- @param #MARKER self
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:ToNeutral(Delay)
self:ToCoalition(coalition.side.NEUTRAL, Delay)
function MARKER:ToNeutral( Delay )
self:ToCoalition( coalition.side.NEUTRAL, Delay )
return self
end
--- Place marker visible for a specific group only.
-- @param #MARKER self
-- @param Wrapper.Group#GROUP Group The group to which the marker is displayed.
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:ToGroup(Group, Delay)
function MARKER:ToGroup( Group, Delay )
if Delay and Delay>0 then
self:ScheduleOnce(Delay, MARKER.ToGroup, self, Group)
if Delay and Delay > 0 then
self:ScheduleOnce( Delay, MARKER.ToGroup, self, Group )
else
-- Check if group exists.
if Group and Group:IsAlive()~=nil then
if Group and Group:IsAlive() ~= nil then
self.groupid=Group:GetID()
self.groupid = Group:GetID()
if self.groupid then
self.groupname=Group:GetName()
self.groupname = Group:GetName()
self.togroup=true
self.tocoaliton=nil
self.coalition=nil
self.toall=nil
self.togroup = true
self.tocoalition = nil
self.coalition = nil
self.toall = nil
-- First remove an existing mark.
if self.shown then
self:Remove()
end
self.mid=UTILS.GetMarkID()
self.mid = UTILS.GetMarkID()
-- Call DCS function.
trigger.action.markToGroup(self.mid, self.text, self.coordinate:GetVec3(), self.groupid, self.readonly, self.message)
trigger.action.markToGroup( self.mid, self.text, self.coordinate:GetVec3(), self.groupid, self.readonly, self.message )
end
else
--TODO: Warning!
-- TODO: Warning!
end
end
@@ -488,17 +482,17 @@ end
-- @param #string Text Updated text.
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:UpdateText(Text, Delay)
function MARKER:UpdateText( Text, Delay )
if Delay and Delay>0 then
self:ScheduleOnce(Delay, MARKER.UpdateText, self, Text)
if Delay and Delay > 0 then
self:ScheduleOnce( Delay, MARKER.UpdateText, self, Text )
else
self.text=tostring(Text)
self.text = tostring( Text )
self:Refresh()
self:TextUpdate(tostring(Text))
self:TextUpdate( tostring( Text ) )
end
@@ -510,17 +504,17 @@ end
-- @param Core.Point#COORDINATE Coordinate The new coordinate.
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:UpdateCoordinate(Coordinate, Delay)
function MARKER:UpdateCoordinate( Coordinate, Delay )
if Delay and Delay>0 then
self:ScheduleOnce(Delay, MARKER.UpdateCoordinate, self, Coordinate)
if Delay and Delay > 0 then
self:ScheduleOnce( Delay, MARKER.UpdateCoordinate, self, Coordinate )
else
self.coordinate=Coordinate
self.coordinate = Coordinate
self:Refresh()
self:CoordUpdate(Coordinate)
self:CoordUpdate( Coordinate )
end
@@ -531,28 +525,28 @@ end
-- @param #MARKER self
-- @param #number Delay (Optional) Delay in seconds, before the marker is created.
-- @return #MARKER self
function MARKER:Refresh(Delay)
function MARKER:Refresh( Delay )
if Delay and Delay>0 then
self:ScheduleOnce(Delay, MARKER.Refresh, self)
if Delay and Delay > 0 then
self:ScheduleOnce( Delay, MARKER.Refresh, self )
else
if self.toall then
self:ToAll()
elseif self.tocoaliton then
elseif self.tocoalition then
self:ToCoalition(self.coalition)
self:ToCoalition( self.coalition )
elseif self.togroup then
local group=GROUP:FindByName(self.groupname)
local group = GROUP:FindByName( self.groupname )
self:ToGroup(group)
self:ToGroup( group )
else
self:E(self.lid.."ERROR: unknown To in :Refresh()!")
self:E( self.lid .. "ERROR: unknown To in :Refresh()!" )
end
end
@@ -564,16 +558,16 @@ end
-- @param #MARKER self
-- @param #number Delay (Optional) Delay in seconds, before the marker is removed.
-- @return #MARKER self
function MARKER:Remove(Delay)
function MARKER:Remove( Delay )
if Delay and Delay>0 then
self:ScheduleOnce(Delay, MARKER.Remove, self)
if Delay and Delay > 0 then
self:ScheduleOnce( Delay, MARKER.Remove, self )
else
if self.shown then
-- Call DCS function.
trigger.action.removeMark(self.mid)
trigger.action.removeMark( self.mid )
end
@@ -600,24 +594,23 @@ end
-- @param #MARKER self
-- @param #string Text Marker text. Default is an empty string "".
-- @return #MARKER self
function MARKER:SetText(Text)
self.text=Text and tostring(Text) or ""
function MARKER:SetText( Text )
self.text = Text and tostring( Text ) or ""
return self
end
--- Check if marker is currently visible on the F10 map.
-- @param #MARKER self
-- @return #boolean True if the marker is currently visible.
function MARKER:IsVisible()
return self:Is("Visible")
return self:Is( "Visible" )
end
--- Check if marker is currently invisible on the F10 map.
-- @param #MARKER self
-- @return
function MARKER:IsInvisible()
return self:Is("Invisible")
return self:Is( "Invisible" )
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -627,19 +620,19 @@ end
--- Event function when a MARKER is added.
-- @param #MARKER self
-- @param Core.Event#EVENTDATA EventData
function MARKER:OnEventMarkAdded(EventData)
function MARKER:OnEventMarkAdded( EventData )
if EventData and EventData.MarkID then
local MarkID=EventData.MarkID
local MarkID = EventData.MarkID
self:T3(self.lid..string.format("Captured event MarkAdded for Mark ID=%s", tostring(MarkID)))
self:T3( self.lid .. string.format( "Captured event MarkAdded for Mark ID=%s", tostring( MarkID ) ) )
if MarkID==self.mid then
if MarkID == self.mid then
self.shown=true
self.shown = true
self:Added(EventData)
self:Added( EventData )
end
@@ -650,19 +643,21 @@ end
--- Event function when a MARKER is removed.
-- @param #MARKER self
-- @param Core.Event#EVENTDATA EventData
function MARKER:OnEventMarkRemoved(EventData)
function MARKER:OnEventMarkRemoved( EventData )
if EventData and EventData.MarkID then
local MarkID = EventData.MarkID
local MarkID=EventData.MarkID
self:T3(self.lid..string.format("Captured event MarkRemoved for Mark ID=%s", tostring(MarkID)))
if MarkID==self.mid then
if MarkID == self.mid then
self.shown=false
self.shown = false
self:Removed(EventData)
self:Removed( EventData )
end
@@ -673,10 +668,16 @@ end
--- Event function when a MARKER changed.
-- @param #MARKER self
-- @param Core.Event#EVENTDATA EventData
function MARKER:OnEventMarkChange(EventData)
function MARKER:OnEventMarkChange( EventData )
if EventData and EventData.MarkID then
local MarkID = EventData.MarkID
self:T3( self.lid .. string.format( "Captured event MarkChange for Mark ID=%s", tostring( MarkID ) ) )
if MarkID == self.mid then
local MarkID=EventData.MarkID
self:T3(self.lid..string.format("Captured event MarkChange for Mark ID=%s", tostring(MarkID)))
@@ -692,7 +693,7 @@ function MARKER:OnEventMarkChange(EventData)
end
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- FSM Event Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -703,17 +704,17 @@ end
-- @param #string Event Event.
-- @param #string To To state.
-- @param Core.Event#EVENTDATA EventData Event data table.
function MARKER:onafterAdded(From, Event, To, EventData)
function MARKER:onafterAdded( From, Event, To, EventData )
-- Debug info.
local text=string.format("Captured event MarkAdded for myself:\n")
text=text..string.format("Marker ID = %s\n", tostring(EventData.MarkID))
text=text..string.format("Coalition = %s\n", tostring(EventData.MarkCoalition))
text=text..string.format("Group ID = %s\n", tostring(EventData.MarkGroupID))
text=text..string.format("Initiator = %s\n", EventData.IniUnit and EventData.IniUnit:GetName() or "Nobody")
text=text..string.format("Coordinate = %s\n", EventData.MarkCoordinate and EventData.MarkCoordinate:ToStringLLDMS() or "Nowhere")
text=text..string.format("Text: \n%s", tostring(EventData.MarkText))
self:T2(self.lid..text)
local text = string.format( "Captured event MarkAdded for myself:\n" )
text = text .. string.format( "Marker ID = %s\n", tostring( EventData.MarkID ) )
text = text .. string.format( "Coalition = %s\n", tostring( EventData.MarkCoalition ) )
text = text .. string.format( "Group ID = %s\n", tostring( EventData.MarkGroupID ) )
text = text .. string.format( "Initiator = %s\n", EventData.IniUnit and EventData.IniUnit:GetName() or "Nobody" )
text = text .. string.format( "Coordinate = %s\n", EventData.MarkCoordinate and EventData.MarkCoordinate:ToStringLLDMS() or "Nowhere" )
text = text .. string.format( "Text: \n%s", tostring( EventData.MarkText ) )
self:T2( self.lid .. text )
end
@@ -723,17 +724,17 @@ end
-- @param #string Event Event.
-- @param #string To To state.
-- @param Core.Event#EVENTDATA EventData Event data table.
function MARKER:onafterRemoved(From, Event, To, EventData)
function MARKER:onafterRemoved( From, Event, To, EventData )
-- Debug info.
local text=string.format("Captured event MarkRemoved for myself:\n")
text=text..string.format("Marker ID = %s\n", tostring(EventData.MarkID))
text=text..string.format("Coalition = %s\n", tostring(EventData.MarkCoalition))
text=text..string.format("Group ID = %s\n", tostring(EventData.MarkGroupID))
text=text..string.format("Initiator = %s\n", EventData.IniUnit and EventData.IniUnit:GetName() or "Nobody")
text=text..string.format("Coordinate = %s\n", EventData.MarkCoordinate and EventData.MarkCoordinate:ToStringLLDMS() or "Nowhere")
text=text..string.format("Text: \n%s", tostring(EventData.MarkText))
self:T2(self.lid..text)
local text = string.format( "Captured event MarkRemoved for myself:\n" )
text = text .. string.format( "Marker ID = %s\n", tostring( EventData.MarkID ) )
text = text .. string.format( "Coalition = %s\n", tostring( EventData.MarkCoalition ) )
text = text .. string.format( "Group ID = %s\n", tostring( EventData.MarkGroupID ) )
text = text .. string.format( "Initiator = %s\n", EventData.IniUnit and EventData.IniUnit:GetName() or "Nobody" )
text = text .. string.format( "Coordinate = %s\n", EventData.MarkCoordinate and EventData.MarkCoordinate:ToStringLLDMS() or "Nowhere" )
text = text .. string.format( "Text: \n%s", tostring( EventData.MarkText ) )
self:T2( self.lid .. text )
end
@@ -743,17 +744,17 @@ end
-- @param #string Event Event.
-- @param #string To To state.
-- @param Core.Event#EVENTDATA EventData Event data table.
function MARKER:onafterChanged(From, Event, To, EventData)
function MARKER:onafterChanged( From, Event, To, EventData )
-- Debug info.
local text=string.format("Captured event MarkChange for myself:\n")
text=text..string.format("Marker ID = %s\n", tostring(EventData.MarkID))
text=text..string.format("Coalition = %s\n", tostring(EventData.MarkCoalition))
text=text..string.format("Group ID = %s\n", tostring(EventData.MarkGroupID))
text=text..string.format("Initiator = %s\n", EventData.IniUnit and EventData.IniUnit:GetName() or "Nobody")
text=text..string.format("Coordinate = %s\n", EventData.MarkCoordinate and EventData.MarkCoordinate:ToStringLLDMS() or "Nowhere")
text=text..string.format("Text: \n%s", tostring(EventData.MarkText))
self:T2(self.lid..text)
local text = string.format( "Captured event MarkChange for myself:\n" )
text = text .. string.format( "Marker ID = %s\n", tostring( EventData.MarkID ) )
text = text .. string.format( "Coalition = %s\n", tostring( EventData.MarkCoalition ) )
text = text .. string.format( "Group ID = %s\n", tostring( EventData.MarkGroupID ) )
text = text .. string.format( "Initiator = %s\n", EventData.IniUnit and EventData.IniUnit:GetName() or "Nobody" )
text = text .. string.format( "Coordinate = %s\n", EventData.MarkCoordinate and EventData.MarkCoordinate:ToStringLLDMS() or "Nowhere" )
text = text .. string.format( "Text: \n%s", tostring( EventData.MarkText ) )
self:T2( self.lid .. text )
end
@@ -763,9 +764,9 @@ end
-- @param #string Event Event.
-- @param #string To To state.
-- @param #string Text The updated text, displayed in the mark panel.
function MARKER:onafterTextUpdate(From, Event, To, Text)
function MARKER:onafterTextUpdate( From, Event, To, Text )
self:T(self.lid..string.format("New Marker Text:\n%s", Text))
self:T( self.lid .. string.format( "New Marker Text:\n%s", Text ) )
end
@@ -775,12 +776,8 @@ end
-- @param #string Event Event.
-- @param #string To To state.
-- @param Core.Point#COORDINATE Coordinate The updated coordinates.
function MARKER:onafterCoordUpdate(From, Event, To, Coordinate)
function MARKER:onafterCoordUpdate( From, Event, To, Coordinate )
self:T(self.lid..string.format("New Marker Coordinate in LL DMS: %s", Coordinate:ToStringLLDMS()))
self:T( self.lid .. string.format( "New Marker Coordinate in LL DMS: %s", Coordinate:ToStringLLDMS() ) )
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -44,7 +44,7 @@
--
-- @field #STATIC
STATIC = {
ClassName = "STATIC",
ClassName = "STATIC",
}
@@ -85,7 +85,7 @@ function STATIC:FindByName( StaticName, RaiseError )
self.StaticName = StaticName
if StaticFound then
return StaticFound
return StaticFound
end
if RaiseError == nil or RaiseError == true then
@@ -256,4 +256,3 @@ function STATIC:ReSpawnAt(Coordinate, Heading, Delay)
return self
end

View File

@@ -104,7 +104,7 @@ UNIT = {
-- Registration.
--- Create a new UNIT from DCSUnit.
-- @param #UNIT self
-- @param #string UnitName The name of the DCS unit.
@@ -650,14 +650,14 @@ end
-- @return #string The name of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetPrefix()
self:F2( self.UnitName )
self:F2( self.UnitName )
local DCSUnit = self:GetDCSObject()
if DCSUnit then
local UnitPrefix = string.match( self.UnitName, ".*#" ):sub( 1, -2 )
self:T3( UnitPrefix )
return UnitPrefix
local UnitPrefix = string.match( self.UnitName, ".*#" ):sub( 1, -2 )
self:T3( UnitPrefix )
return UnitPrefix
end
return nil
@@ -1220,24 +1220,24 @@ end
-- @return true If the other DCS Unit is within the radius of the 2D point of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:OtherUnitInRadius( AwaitUnit, Radius )
self:F2( { self.UnitName, AwaitUnit.UnitName, Radius } )
self:F2( { self.UnitName, AwaitUnit.UnitName, Radius } )
local DCSUnit = self:GetDCSObject()
if DCSUnit then
local UnitVec3 = self:GetVec3()
local AwaitUnitVec3 = AwaitUnit:GetVec3()
local UnitVec3 = self:GetVec3()
local AwaitUnitVec3 = AwaitUnit:GetVec3()
if (((UnitVec3.x - AwaitUnitVec3.x)^2 + (UnitVec3.z - AwaitUnitVec3.z)^2)^0.5 <= Radius) then
self:T3( "true" )
return true
else
self:T3( "false" )
return false
end
if (((UnitVec3.x - AwaitUnitVec3.x)^2 + (UnitVec3.z - AwaitUnitVec3.z)^2)^0.5 <= Radius) then
self:T3( "true" )
return true
else
self:T3( "false" )
return false
end
end
return nil
return nil
end