mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed with A2G tasking
Imagine, the mission had a static moose.lua. I was testing with a static moose.lua
This commit is contained in:
parent
1662b891df
commit
caedaddd06
@ -159,14 +159,24 @@ do -- ACT_ROUTE
|
|||||||
|
|
||||||
local RouteText = ""
|
local RouteText = ""
|
||||||
|
|
||||||
if self.RouteMode == "B" then
|
if self.Coordinate and self.RouteMode == "B" then
|
||||||
RouteText = "Route to " .. FromCoordinate:GetBRText( self.Coordinate ) .. " km."
|
RouteText = "Route to " .. FromCoordinate:GetBRText( self.Coordinate ) .. " km."
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.RouteMode == "C" then
|
if self.Coordinate and self.RouteMode == "C" then
|
||||||
RouteText = "Route to " .. self.Coordinate:ToString()
|
RouteText = "Route to " .. self.Coordinate:ToString()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.Zone and self.RouteMode == "B" then
|
||||||
|
local Coordinate = self.Zone:GetCoordinate()
|
||||||
|
RouteText = "Route to zone bearing " .. FromCoordinate:GetBRText( Coordinate ) .. " km."
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.Zone and self.RouteMode == "C" then
|
||||||
|
local Coordinate = self.Zone:GetCoordinate()
|
||||||
|
RouteText = "Route to zone at " .. Coordinate:ToString()
|
||||||
|
end
|
||||||
|
|
||||||
return RouteText
|
return RouteText
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -223,6 +223,23 @@ function ZONE_BASE:GetPointVec2()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Returns a @{Point#COORDINATE} of the zone.
|
||||||
|
-- @param #ZONE_BASE self
|
||||||
|
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
||||||
|
-- @return Core.Point#COORDINATE The Coordinate of the zone.
|
||||||
|
function ZONE_BASE:GetCoordinate()
|
||||||
|
self:F2( self.ZoneName )
|
||||||
|
|
||||||
|
local Vec2 = self:GetVec2()
|
||||||
|
|
||||||
|
local Coordinate = COORDINATE:NewFromVec2( Vec2 )
|
||||||
|
|
||||||
|
self:T2( { Coordinate } )
|
||||||
|
|
||||||
|
return Coordinate
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Returns the @{DCSTypes#Vec3} of the zone.
|
--- Returns the @{DCSTypes#Vec3} of the zone.
|
||||||
-- @param #ZONE_BASE self
|
-- @param #ZONE_BASE self
|
||||||
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
||||||
|
|||||||
@ -227,21 +227,6 @@ function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefi
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- FSM function for a MISSION
|
|
||||||
-- @param #MISSION self
|
|
||||||
-- @param #string From
|
|
||||||
-- @param #string Event
|
|
||||||
-- @param #string To
|
|
||||||
function MISSION:onbeforeComplete( From, Event, To )
|
|
||||||
|
|
||||||
for TaskID, Task in pairs( self:GetTasks() ) do
|
|
||||||
local Task = Task -- Tasking.Task#TASK
|
|
||||||
if not Task:IsStateSuccess() and not Task:IsStateFAILED() and not Task:IsStateAborted() and not Task:IsStateCancelled() then
|
|
||||||
return false -- Mission cannot be completed. Other Tasks are still active.
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true -- Allow Mission completion.
|
|
||||||
end
|
|
||||||
|
|
||||||
-- FSM function for a MISSION
|
-- FSM function for a MISSION
|
||||||
-- @param #MISSION self
|
-- @param #MISSION self
|
||||||
@ -250,7 +235,7 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
function MISSION:onenterCOMPLETED( From, Event, To )
|
function MISSION:onenterCOMPLETED( From, Event, To )
|
||||||
|
|
||||||
self:GetCommandCenter():MessageToCoalition( "Mission " .. self:GetName() .. " has been completed! Good job guys!" )
|
self:GetCommandCenter():MessageToCoalition( self:GetName() .. " has been completed! Good job guys!" )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the mission name.
|
--- Gets the mission name.
|
||||||
|
|||||||
@ -130,7 +130,7 @@ do -- TASK_A2G
|
|||||||
if Task:GetRendezVousZone( TaskUnit ) then
|
if Task:GetRendezVousZone( TaskUnit ) then
|
||||||
self:__RouteToRendezVousZone( 0.1 )
|
self:__RouteToRendezVousZone( 0.1 )
|
||||||
else
|
else
|
||||||
if Task:GetRendezVousPointVec2( TaskUnit ) then
|
if Task:GetRendezVousCoordinate( TaskUnit ) then
|
||||||
self:__RouteToRendezVousPoint( 0.1 )
|
self:__RouteToRendezVousPoint( 0.1 )
|
||||||
else
|
else
|
||||||
self:__ArriveAtRendezVous( 0.1 )
|
self:__ArriveAtRendezVous( 0.1 )
|
||||||
@ -173,9 +173,9 @@ do -- TASK_A2G
|
|||||||
else
|
else
|
||||||
local TargetUnit = Task.TargetSetUnit:GetFirst() -- Wrapper.Unit#UNIT
|
local TargetUnit = Task.TargetSetUnit:GetFirst() -- Wrapper.Unit#UNIT
|
||||||
if TargetUnit then
|
if TargetUnit then
|
||||||
local PointVec2 = TargetUnit:GetPointVec2()
|
local Coordinate = TargetUnit:GetCoordinate()
|
||||||
self:T( { TargetPointVec2 = PointVec2, PointVec2:GetX(), PointVec2:GetAlt(), PointVec2:GetZ() } )
|
self:T( { TargetCoordinate = Coordinate, Coordinate:GetX(), Coordinate:GetAlt(), Coordinate:GetZ() } )
|
||||||
Task:SetTargetPointVec2( TargetUnit:GetPointVec2(), TaskUnit )
|
Task:SetTargetCoordinate( TargetUnit:GetCoordinate(), TaskUnit )
|
||||||
end
|
end
|
||||||
self:__RouteToTargetPoint( 0.1 )
|
self:__RouteToTargetPoint( 0.1 )
|
||||||
end
|
end
|
||||||
@ -189,7 +189,7 @@ do -- TASK_A2G
|
|||||||
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
|
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
|
||||||
local TargetUnit = Task.TargetSetUnit:GetFirst() -- Wrapper.Unit#UNIT
|
local TargetUnit = Task.TargetSetUnit:GetFirst() -- Wrapper.Unit#UNIT
|
||||||
if TargetUnit then
|
if TargetUnit then
|
||||||
Task:SetTargetPointVec2( TargetUnit:GetPointVec2(), TaskUnit )
|
Task:SetTargetCoordinate( TargetUnit:GetCoordinate(), TaskUnit )
|
||||||
end
|
end
|
||||||
self:__RouteToTargets( -10 )
|
self:__RouteToTargets( -10 )
|
||||||
end
|
end
|
||||||
@ -204,28 +204,28 @@ do -- TASK_A2G
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- @param #TASK_A2G self
|
--- @param #TASK_A2G self
|
||||||
-- @param Core.Point#POINT_VEC2 RendezVousPointVec2 The PointVec2 object referencing to the 2D point where the RendezVous point is located on the map.
|
-- @param Core.Point#COORDINATE RendezVousCoordinate The Coordinate object referencing to the 2D point where the RendezVous point is located on the map.
|
||||||
-- @param #number RendezVousRange The RendezVousRange that defines when the player is considered to have arrived at the RendezVous point.
|
-- @param #number RendezVousRange The RendezVousRange that defines when the player is considered to have arrived at the RendezVous point.
|
||||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||||
function TASK_A2G:SetRendezVousPointVec2( RendezVousPointVec2, RendezVousRange, TaskUnit )
|
function TASK_A2G:SetRendezVousCoordinate( RendezVousCoordinate, RendezVousRange, TaskUnit )
|
||||||
|
|
||||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||||
|
|
||||||
local ActRouteRendezVous = ProcessUnit:GetProcess( "RoutingToRendezVous", "RouteToRendezVousPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
|
local ActRouteRendezVous = ProcessUnit:GetProcess( "RoutingToRendezVous", "RouteToRendezVousPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
|
||||||
ActRouteRendezVous:SetPointVec2( RendezVousPointVec2 )
|
ActRouteRendezVous:SetCoordinate( RendezVousCoordinate )
|
||||||
ActRouteRendezVous:SetRange( RendezVousRange )
|
ActRouteRendezVous:SetRange( RendezVousRange )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #TASK_A2G self
|
--- @param #TASK_A2G self
|
||||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||||
-- @return Core.Point#POINT_VEC2 The PointVec2 object referencing to the 2D point where the RendezVous point is located on the map.
|
-- @return Core.Point#COORDINATE The Coordinate object referencing to the 2D point where the RendezVous point is located on the map.
|
||||||
-- @return #number The RendezVousRange that defines when the player is considered to have arrived at the RendezVous point.
|
-- @return #number The RendezVousRange that defines when the player is considered to have arrived at the RendezVous point.
|
||||||
function TASK_A2G:GetRendezVousPointVec2( TaskUnit )
|
function TASK_A2G:GetRendezVousCoordinate( TaskUnit )
|
||||||
|
|
||||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||||
|
|
||||||
local ActRouteRendezVous = ProcessUnit:GetProcess( "RoutingToRendezVous", "RouteToRendezVousPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
|
local ActRouteRendezVous = ProcessUnit:GetProcess( "RoutingToRendezVous", "RouteToRendezVousPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
|
||||||
return ActRouteRendezVous:GetPointVec2(), ActRouteRendezVous:GetRange()
|
return ActRouteRendezVous:GetCoordinate(), ActRouteRendezVous:GetRange()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -253,26 +253,26 @@ do -- TASK_A2G
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- @param #TASK_A2G self
|
--- @param #TASK_A2G self
|
||||||
-- @param Core.Point#POINT_VEC2 TargetPointVec2 The PointVec2 object where the Target is located on the map.
|
-- @param Core.Point#COORDINATE TargetCoordinate The Coordinate object where the Target is located on the map.
|
||||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||||
function TASK_A2G:SetTargetPointVec2( TargetPointVec2, TaskUnit )
|
function TASK_A2G:SetTargetCoordinate( TargetCoordinate, TaskUnit )
|
||||||
|
|
||||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||||
|
|
||||||
local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
|
local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
|
||||||
ActRouteTarget:SetPointVec2( TargetPointVec2 )
|
ActRouteTarget:SetCoordinate( TargetCoordinate )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #TASK_A2G self
|
--- @param #TASK_A2G self
|
||||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||||
-- @return Core.Point#POINT_VEC2 The PointVec2 object where the Target is located on the map.
|
-- @return Core.Point#COORDINATE The Coordinate object where the Target is located on the map.
|
||||||
function TASK_A2G:GetTargetPointVec2( TaskUnit )
|
function TASK_A2G:GetTargetCoordinate( TaskUnit )
|
||||||
|
|
||||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||||
|
|
||||||
local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
|
local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
|
||||||
return ActRouteTarget:GetPointVec2()
|
return ActRouteTarget:GetCoordinate()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user