From 51e50bee71ec71d52734d5dfbbb9a9084828071f Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Mon, 11 Sep 2017 06:51:14 +0200
Subject: [PATCH] Added methods to COORDINATE to place marks on the map
* Added new methods to COORDINATE allowing to place marks for players on
the map. Now marks can be placed on the map using :AddToAll(),
:MarkToCoalition(), :MarkToCoalitionRed(), :MarkToCoalitionBlue(),
:MarkToGroup() and marks can be removed using :RemoveMark()
---
Moose Development/Moose/Core/Point.lua | 94 +++++++
Moose Development/Moose/Utilities/Utils.lua | 12 +-
docs/Documentation/AI_A2A.html | 1 +
docs/Documentation/AI_A2A_Dispatcher.html | 59 +++--
docs/Documentation/Cargo.html | 1 +
docs/Documentation/Designate.html | 22 +-
docs/Documentation/Detection.html | 2 +
docs/Documentation/Movement.html | 4 -
docs/Documentation/Point.html | 277 +++++++++++++++++++-
docs/Documentation/Spawn.html | 26 +-
docs/Documentation/SpawnStatic.html | 1 +
docs/Documentation/Spot.html | 4 -
docs/Documentation/Task.html | 60 +++++
docs/Documentation/Utils.html | 42 +++
14 files changed, 575 insertions(+), 30 deletions(-)
diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua
index 1f5b26f39..25ea827ea 100644
--- a/Moose Development/Moose/Core/Point.lua
+++ b/Moose Development/Moose/Core/Point.lua
@@ -90,6 +90,18 @@ do -- COORDINATE
-- * @{#COORDINATE.IlluminationBomb}(): To illuminate the point.
--
--
+ -- ## Markings
+ --
+ -- Place markers (text boxes with clarifications for briefings, target locations or any other reference point) on the map for all players, coalitions or specific groups:
+ --
+ -- * @{#COORDINATE.MarkToAll}(): Place a mark to all players.
+ -- * @{#COORDINATE.MarkToCoalition}(): Place a mark to a coalition.
+ -- * @{#COORDINATE.MarkToCoalitionRed}(): Place a mark to the red coalition.
+ -- * @{#COORDINATE.MarkToCoalitionBlue}(): Place a mark to the blue coalition.
+ -- * @{#COORDINATE.MarkToGroup}(): Place a mark to a group (needs to have a client in it or a CA group (CA group is bugged)).
+ -- * @{#COORDINATE.RemoveMark}(): Removes a mark from the map.
+ --
+ --
-- ## 3D calculation methods
--
-- Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
@@ -650,6 +662,88 @@ do -- COORDINATE
self:F2( Azimuth )
self:Flare( FLARECOLOR.Red, Azimuth )
end
+
+ do -- Markings
+
+ --- Mark to All
+ -- @param #COORDINATE self
+ -- @param #string MarkText Free format text that shows the marking clarification.
+ -- @return #number The resulting Mark ID which is a number.
+ -- @usage
+ -- local TargetCoord = TargetGroup:GetCoordinate()
+ -- local MarkID = TargetCoord:MarkToAll( "This is a target for all players" )
+ function COORDINATE:MarkToAll( MarkText )
+ local MarkID = UTILS.GetMarkID()
+ trigger.action.markToAll( MarkID, MarkText, self:GetVec3() )
+ return MarkID
+ end
+
+ --- Mark to Coalition
+ -- @param #COORDINATE self
+ -- @param #string MarkText Free format text that shows the marking clarification.
+ -- @param Coalition
+ -- @return #number The resulting Mark ID which is a number.
+ -- @usage
+ -- local TargetCoord = TargetGroup:GetCoordinate()
+ -- local MarkID = TargetCoord:MarkToCoalition( "This is a target for the red coalition", coalition.side.RED )
+ function COORDINATE:MarkToCoalition( MarkText, Coalition )
+ local MarkID = UTILS.GetMarkID()
+ trigger.action.markToCoalition( MarkID, MarkText, self:GetVec3(), Coalition )
+ return MarkID
+ end
+
+ --- Mark to Red Coalition
+ -- @param #COORDINATE self
+ -- @param #string MarkText Free format text that shows the marking clarification.
+ -- @return #number The resulting Mark ID which is a number.
+ -- @usage
+ -- local TargetCoord = TargetGroup:GetCoordinate()
+ -- local MarkID = TargetCoord:MarkToCoalitionRed( "This is a target for the red coalition" )
+ function COORDINATE:MarkToCoalitionRed( MarkText )
+ return self:MarkToCoalition( MarkText, coalition.side.RED )
+ end
+
+ --- Mark to Blue Coalition
+ -- @param #COORDINATE self
+ -- @param #string MarkText Free format text that shows the marking clarification.
+ -- @return #number The resulting Mark ID which is a number.
+ -- @usage
+ -- local TargetCoord = TargetGroup:GetCoordinate()
+ -- local MarkID = TargetCoord:MarkToCoalitionBlue( "This is a target for the blue coalition" )
+ function COORDINATE:MarkToCoalitionBlue( MarkText )
+ return self:MarkToCoalition( MarkText, coalition.side.BLUE )
+ end
+
+ --- Mark to Group
+ -- @param #COORDINATE self
+ -- @param #string MarkText Free format text that shows the marking clarification.
+ -- @param Wrapper.Group#GROUP MarkGroup The @{Group} that receives the mark.
+ -- @return #number The resulting Mark ID which is a number.
+ -- @usage
+ -- local TargetCoord = TargetGroup:GetCoordinate()
+ -- local MarkGroup = GROUP:FindByName( "AttackGroup" )
+ -- local MarkID = TargetCoord:MarkToGroup( "This is a target for the attack group", AttackGroup )
+ function COORDINATE:MarkToCoalition( MarkText, MarkGroup )
+ local MarkID = UTILS.GetMarkID()
+ trigger.action.markToGroup( MarkID, MarkText, self:GetVec3(), MarkGroup:GetID() )
+ return MarkID
+ end
+
+ --- Remove a mark
+ -- @param #COORDINATE self
+ -- @param #number MarkID The ID of the mark to be removed.
+ -- @usage
+ -- local TargetCoord = TargetGroup:GetCoordinate()
+ -- local MarkGroup = GROUP:FindByName( "AttackGroup" )
+ -- local MarkID = TargetCoord:MarkToGroup( "This is a target for the attack group", AttackGroup )
+ -- <<< logic >>>
+ -- RemoveMark( MarkID ) -- The mark is now removed
+ function COORDINATE:RemoveMark( MarkID )
+ trigger.action.removeMark( MarkID )
+ end
+
+ end -- Markings
+
--- Returns if a Coordinate has Line of Sight (LOS) with the ToCoordinate.
-- @param #COORDINATE self
diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua
index dc292d942..44d7f24e3 100644
--- a/Moose Development/Moose/Utilities/Utils.lua
+++ b/Moose Development/Moose/Utilities/Utils.lua
@@ -31,7 +31,9 @@ FLARECOLOR = trigger.flareColor -- #FLARECOLOR
--- Utilities static class.
-- @type UTILS
-UTILS = {}
+UTILS = {
+ _MarkID = 0
+}
--- Function to infer instance of an object
--
@@ -395,3 +397,11 @@ function UTILS.spairs( t, order )
end
end
end
+
+-- get a new mark ID for markings
+function UTILS.GetMarkID()
+
+ UTILS._MarkID = UTILS._MarkID + 1
+ return UTILS._MarkID
+
+end
diff --git a/docs/Documentation/AI_A2A.html b/docs/Documentation/AI_A2A.html
index 6d716e063..34f484bce 100644
--- a/docs/Documentation/AI_A2A.html
+++ b/docs/Documentation/AI_A2A.html
@@ -661,6 +661,7 @@
-
+ #number
AI_A2A.IdleCount
diff --git a/docs/Documentation/AI_A2A_Dispatcher.html b/docs/Documentation/AI_A2A_Dispatcher.html
index 703bc7751..93e30f590 100644
--- a/docs/Documentation/AI_A2A_Dispatcher.html
+++ b/docs/Documentation/AI_A2A_Dispatcher.html
@@ -341,13 +341,13 @@ Per one, two, three, four?
- | AI_A2A_DISPATCHER:CountDefendersEngaged(Target) |
+ AI_A2A_DISPATCHER:CountDefendersEngaged(AttackerDetection) |
|
- | AI_A2A_DISPATCHER:CountDefendersToBeEngaged(DetectedItem, DefenderCount) |
+ AI_A2A_DISPATCHER:CountDefendersToBeEngaged(AttackerDetection, DefenderCount) |
|
@@ -464,6 +464,12 @@ Per one, two, three, four?
AI_A2A_DISPATCHER:GetDefenderTaskFsm(Defender) |
+ |
+
+
+ | AI_A2A_DISPATCHER:GetDefenderTaskSquadronName(Defender) |
+
+
|
@@ -719,7 +725,7 @@ Per one, two, three, four?
- | AI_A2A_DISPATCHER:SetDefenderTaskTarget(AIGroup, Defender, Target) |
+ AI_A2A_DISPATCHER:SetDefenderTaskTarget(AIGroup, Defender, AttackerDetection) |
|
@@ -905,13 +911,13 @@ Per one, two, three, four?
- | AI_A2A_DISPATCHER:onafterENGAGE(From, Event, To, Target, Defenders) |
+ AI_A2A_DISPATCHER:onafterENGAGE(From, Event, To, AttackerDetection, Defenders) |
|
- | AI_A2A_DISPATCHER:onafterGCI(From, Event, To, DetectedItem, DefendersMissing, Friendlies) |
+ AI_A2A_DISPATCHER:onafterGCI(From, Event, To, AttackerDetection, DefendersMissing, DefenderFriendlies) |
|
@@ -2104,7 +2110,7 @@ DefenderSquadron
-AI_A2A_DISPATCHER:CountDefendersEngaged(Target)
+AI_A2A_DISPATCHER:CountDefendersEngaged(AttackerDetection)
@@ -2115,7 +2121,7 @@ DefenderSquadron
-
-
Target :
+ AttackerDetection :
@@ -2125,7 +2131,7 @@ DefenderSquadron
-AI_A2A_DISPATCHER:CountDefendersToBeEngaged(DetectedItem, DefenderCount)
+AI_A2A_DISPATCHER:CountDefendersToBeEngaged(AttackerDetection, DefenderCount)
@@ -2136,7 +2142,7 @@ DefenderSquadron
-
-
DetectedItem :
+ AttackerDetection :
-
@@ -2544,6 +2550,27 @@ Takeoff From the airbase hot, from the airbase cold, in the air, from the runway
+
Parameter
+
+
+
+
+-
+
+
+AI_A2A_DISPATCHER:GetDefenderTaskSquadronName(Defender)
+
+
+-
+
+
+
Parameter
@@ -5222,7 +5249,7 @@ Provide a value of true to display every 30 seconds a tactical
-
-AI_A2A_DISPATCHER:onafterENGAGE(From, Event, To, Target, Defenders)
+AI_A2A_DISPATCHER:onafterENGAGE(From, Event, To, AttackerDetection, Defenders)
-
@@ -5248,7 +5275,7 @@ Provide a value of true to display every 30 seconds a tactical
-
-
Target :
+ AttackerDetection :
-
@@ -5263,7 +5290,7 @@ Provide a value of true to display every 30 seconds a tactical
-
-AI_A2A_DISPATCHER:onafterGCI(From, Event, To, DetectedItem, DefendersMissing, Friendlies)
+AI_A2A_DISPATCHER:onafterGCI(From, Event, To, AttackerDetection, DefendersMissing, DefenderFriendlies)
-
@@ -5289,7 +5316,7 @@ Provide a value of true to display every 30 seconds a tactical
-
-
DetectedItem :
+ AttackerDetection :
-
@@ -5299,7 +5326,7 @@ Provide a value of true to display every 30 seconds a tactical
-
-
Friendlies :
+ DefenderFriendlies :
diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html
index a11fd4dba..21b706849 100644
--- a/docs/Documentation/Cargo.html
+++ b/docs/Documentation/Cargo.html
@@ -3543,6 +3543,7 @@ The range till cargo will board.
-
+ #number
CARGO_UNIT.RunCount
diff --git a/docs/Documentation/Designate.html b/docs/Documentation/Designate.html
index 31210aea8..da55e5179 100644
--- a/docs/Documentation/Designate.html
+++ b/docs/Documentation/Designate.html
@@ -257,6 +257,12 @@ each detected set of potential targets can be lased or smoked...
| DESIGNATE:LaseOn() |
LaseOn Trigger for DESIGNATE
+ |
+
+
+ | DESIGNATE.LaseStart |
+
+
|
@@ -1090,7 +1096,7 @@ function below will use the range 1-7 just in case
-
- #number
+
DESIGNATE.LaseDuration
@@ -1125,6 +1131,20 @@ function below will use the range 1-7 just in case
LaseOn Trigger for DESIGNATE
+
+
+
+-
+
+
+
+DESIGNATE.LaseStart
+
+
+-
+
+
+
diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html
index e055abe7c..aa6ec9489 100644
--- a/docs/Documentation/Detection.html
+++ b/docs/Documentation/Detection.html
@@ -2465,6 +2465,7 @@ The index of the DetectedItem.
-
+ #number
DETECTION_BASE.DetectedItemCount
@@ -2478,6 +2479,7 @@ The index of the DetectedItem.
-
+ #number
DETECTION_BASE.DetectedItemMax
diff --git a/docs/Documentation/Movement.html b/docs/Documentation/Movement.html
index be5ce073c..4307c3aaa 100644
--- a/docs/Documentation/Movement.html
+++ b/docs/Documentation/Movement.html
@@ -227,7 +227,6 @@ on defined intervals (currently every minute).
-
- #number
MOVEMENT.AliveUnits
@@ -236,9 +235,6 @@ on defined intervals (currently every minute).
-
-
Contains the counter how many units are currently alive
-
diff --git a/docs/Documentation/Point.html b/docs/Documentation/Point.html
index 4c79fc8f9..fef7b4f04 100644
--- a/docs/Documentation/Point.html
+++ b/docs/Documentation/Point.html
@@ -315,6 +315,30 @@
| COORDINATE:IsLOS(ToCoordinate) |
Returns if a Coordinate has Line of Sight (LOS) with the ToCoordinate.
+ |
+
+
+ | COORDINATE:MarkToAll(MarkText) |
+
+ Mark to All
+ |
+
+
+ | COORDINATE:MarkToCoalition(MarkText, Coalition) |
+
+ Mark to Coalition
+ |
+
+
+ | COORDINATE:MarkToCoalitionBlue(MarkText) |
+
+ Mark to Blue Coalition
+ |
+
+
+ | COORDINATE:MarkToCoalitionRed(MarkText) |
+
+ Mark to Red Coalition
|
@@ -333,6 +357,12 @@
| COORDINATE:NewFromVec3(Vec3) |
Create a new COORDINATE object from Vec3 coordinates.
+ |
+
+
+ | COORDINATE:RemoveMark(MarkID) |
+
+ Remove a mark
|
@@ -382,6 +412,18 @@
|
Provides a coordinate string of the point, based on a coordinate format system:
* Uses default settings in COORDINATE.
+ |
+
+
+ | COORDINATE:ToStringA2A(Controllable, Settings) |
+
+ Provides a coordinate string of the point, based on the A2A coordinate format system.
+ |
+
+
+ | COORDINATE:ToStringA2G(Controllable, Settings) |
+
+ Provides a coordinate string of the point, based on the A2G coordinate format system.
|
@@ -850,6 +892,20 @@
+Markings
+
+Place markers (text boxes with clarifications for briefings, target locations or any other reference point) on the map for all players, coalitions or specific groups:
+
+
+
+
3D calculation methods
Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
@@ -1688,6 +1744,135 @@ true If the ToCoordinate has LOS with the Coordinate, otherwise false.
-
+
+COORDINATE:MarkToAll(MarkText)
+
+
+-
+
+
Mark to All
+
+ Parameter
+
+ Return value
+
+#number:
+The resulting Mark ID which is a number.
+
+ Usage:
+ local TargetCoord = TargetGroup:GetCoordinate()
+ local MarkID = TargetCoord:MarkToAll( "This is a target for all players" )
+
+
+
+
+-
+
+
+COORDINATE:MarkToCoalition(MarkText, Coalition)
+
+
+-
+
+
Mark to Coalition
+
+ Parameters
+
+ Return value
+
+#number:
+The resulting Mark ID which is a number.
+
+ Usage:
+ local TargetCoord = TargetGroup:GetCoordinate()
+ local MarkID = TargetCoord:MarkToCoalition( "This is a target for the red coalition", coalition.side.RED )
+
+
+
+
+-
+
+
+COORDINATE:MarkToCoalitionBlue(MarkText)
+
+
+-
+
+
Mark to Blue Coalition
+
+ Parameter
+
+ Return value
+
+#number:
+The resulting Mark ID which is a number.
+
+ Usage:
+ local TargetCoord = TargetGroup:GetCoordinate()
+ local MarkID = TargetCoord:MarkToCoalitionBlue( "This is a target for the blue coalition" )
+
+
+
+
+-
+
+
+COORDINATE:MarkToCoalitionRed(MarkText)
+
+
+-
+
+
Mark to Red Coalition
+
+ Parameter
+
+ Return value
+
+#number:
+The resulting Mark ID which is a number.
+
+ Usage:
+ local TargetCoord = TargetGroup:GetCoordinate()
+ local MarkID = TargetCoord:MarkToCoalitionRed( "This is a target for the red coalition" )
+
+
+
+
+-
+
COORDINATE:New(x, y, z)
@@ -1782,6 +1967,35 @@ The Vec3 point.
#COORDINATE:
+
+
+
+-
+
+
+COORDINATE:RemoveMark(MarkID)
+
+
+-
+
+
Remove a mark
+
+ Parameter
+
+ Usage:
+ local TargetCoord = TargetGroup:GetCoordinate()
+ local MarkGroup = GROUP:FindByName( "AttackGroup" )
+ local MarkID = TargetCoord:MarkToGroup( "This is a target for the attack group", AttackGroup )
+ <<< logic >>>
+ RemoveMark( MarkID ) -- The mark is now removed
+
@@ -1937,6 +2151,68 @@ The coordinate Text in the configured coordinate system.
-
+
+COORDINATE:ToStringA2A(Controllable, Settings)
+
+
+-
+
+
Provides a coordinate string of the point, based on the A2A coordinate format system.
+
+ Parameters
+
+ Return value
+
+#string:
+The coordinate Text in the configured coordinate system.
+
+
+
+
+-
+
+
+COORDINATE:ToStringA2G(Controllable, Settings)
+
+
+-
+
+
Provides a coordinate string of the point, based on the A2G coordinate format system.
+
+ Parameters
+
+ Return value
+
+#string:
+The coordinate Text in the configured coordinate system.
+
+
+
+
+-
+
COORDINATE:ToStringAspect(TargetCoordinate)
@@ -2862,7 +3138,6 @@ The y coordinate.
-
-
POINT_VEC2.z
diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html
index 3c14d9de6..aa863f1f4 100644
--- a/docs/Documentation/Spawn.html
+++ b/docs/Documentation/Spawn.html
@@ -822,6 +822,12 @@ and any spaces before and after the resulting name are removed.
| SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle) |
+ |
+
+
+ | SPAWN.uncontrolled |
+
+
|
@@ -2194,9 +2200,6 @@ The group that was spawned. You can use this group for further actions.
-
- Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
-
@@ -2735,6 +2738,9 @@ when nothing was spawned.
+
+ Overwrite unit names by default with group name.
+
@@ -3733,6 +3739,20 @@ True = Continue Scheduler
+
+
+
+-
+
+
+
+SPAWN.uncontrolled
+
+
+-
+
+
+
diff --git a/docs/Documentation/SpawnStatic.html b/docs/Documentation/SpawnStatic.html
index bc91b9624..d8aa5e633 100644
--- a/docs/Documentation/SpawnStatic.html
+++ b/docs/Documentation/SpawnStatic.html
@@ -436,6 +436,7 @@ ptional) The name of the new static.
-
+ #number
SPAWNSTATIC.SpawnIndex
diff --git a/docs/Documentation/Spot.html b/docs/Documentation/Spot.html
index 5fdc3b305..ead3792db 100644
--- a/docs/Documentation/Spot.html
+++ b/docs/Documentation/Spot.html
@@ -765,7 +765,6 @@ true if it is lasing
-
-
SPOT.ScheduleID
@@ -779,7 +778,6 @@ true if it is lasing
-
-
SPOT.SpotIR
@@ -793,7 +791,6 @@ true if it is lasing
-
-
SPOT.SpotLaser
@@ -807,7 +804,6 @@ true if it is lasing
-
-
SPOT.Target
diff --git a/docs/Documentation/Task.html b/docs/Documentation/Task.html
index dd18375a7..69575e798 100644
--- a/docs/Documentation/Task.html
+++ b/docs/Documentation/Task.html
@@ -237,6 +237,12 @@
| TASK:GetID() |
Gets the ID of the Task
+ |
+
+
+ | TASK:GetInfo(TaskInfo) |
+
+ Gets the Information of the Task
|
@@ -417,6 +423,12 @@
| TASK.MenuAssigned |
+ |
+
+
+ | TASK:MenuMarkToGroup(TaskGroup) |
+
+
|
@@ -1333,6 +1345,33 @@ TaskID
-
+
+TASK:GetInfo(TaskInfo)
+
+
+-
+
+
Gets the Information of the Task
+
+ Parameter
+
+ Return value
+
+#string:
+TaskInfoText The Task info text.
+
+
+
+
+-
+
TASK:GetMission()
@@ -1887,6 +1926,27 @@ true if Unit is part of the Task.
+
+
+
+-
+
+
+
+-
+
+
+
+
Parameter
+
diff --git a/docs/Documentation/Utils.html b/docs/Documentation/Utils.html
index 13adb0b4a..3fbab0987 100644
--- a/docs/Documentation/Utils.html
+++ b/docs/Documentation/Utils.html
@@ -236,6 +236,12 @@ which are excellent tools to be reused in an OO environment!.
| UTILS.FeetToMeters(feet) |
+ |
+
+
+ | UTILS.GetMarkID() |
+
+
|
@@ -332,6 +338,12 @@ use negative idp for rounding ahead of decimal place, positive for rounding afte
| UTILS.ToRadian(angle) |
+ |
+
+
+ | UTILS._MarkID |
+
+
|
@@ -637,6 +649,22 @@ use negative idp for rounding ahead of decimal place, positive for rounding afte
-
+
+UTILS.GetMarkID()
+
+
+-
+
+
+
+
+
get a new mark ID for markings
+
+
+
+
+-
+
UTILS.IsInstanceOf(object, className)
@@ -943,6 +971,20 @@ use negative idp for rounding ahead of decimal place, positive for rounding afte
+
+
+
+-
+
+ #number
+
+UTILS._MarkID
+
+
+-
+
+
+