mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops little fixes
This commit is contained in:
@@ -774,12 +774,8 @@ do -- COORDINATE
|
|||||||
|
|
||||||
local a={x=TargetCoordinate.x-self.x, y=0, z=TargetCoordinate.z-self.z}
|
local a={x=TargetCoordinate.x-self.x, y=0, z=TargetCoordinate.z-self.z}
|
||||||
|
|
||||||
return UTILS.VecNorm(a)
|
local norm=UTILS.VecNorm(a)
|
||||||
|
return norm
|
||||||
--local TargetVec3 = TargetCoordinate:GetVec3()
|
|
||||||
--local SourceVec3 = self:GetVec3()
|
|
||||||
|
|
||||||
--return ( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the temperature in Degrees Celsius.
|
--- Returns the temperature in Degrees Celsius.
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
-- @field #number missionAltitude Mission altitude in meters.
|
-- @field #number missionAltitude Mission altitude in meters.
|
||||||
-- @field #number missionFraction Mission coordiante fraction. Default is 0.5.
|
-- @field #number missionFraction Mission coordiante fraction. Default is 0.5.
|
||||||
-- @field #number missionRange Mission range in meters. Used in AIRWING class.
|
-- @field #number missionRange Mission range in meters. Used in AIRWING class.
|
||||||
|
-- @field Core.Point#COORDINATE missionWaypointCoord Mission waypoint coordinate.
|
||||||
--
|
--
|
||||||
-- @field #table enrouteTasks Mission enroute tasks.
|
-- @field #table enrouteTasks Mission enroute tasks.
|
||||||
--
|
--
|
||||||
@@ -1061,7 +1062,7 @@ end
|
|||||||
--- Create an ESCORT (or FOLLOW) mission. Flight will escort another group and automatically engage certain target types.
|
--- Create an ESCORT (or FOLLOW) mission. Flight will escort another group and automatically engage certain target types.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Wrapper.Group#GROUP EscortGroup The group to escort.
|
-- @param Wrapper.Group#GROUP EscortGroup The group to escort.
|
||||||
-- @param DCS#Vec3 OffsetVector A table with x, y and z components specifying the offset of the flight to the escorted group. Default {x=200, y=0, z=-100} for 200 meters to the right, same alitude, 100 meters behind.
|
-- @param DCS#Vec3 OffsetVector A table with x, y and z components specifying the offset of the flight to the escorted group. Default {x=-100, y=0, z=200} for z=200 meters to the right, same alitude, x=100 meters behind.
|
||||||
-- @param #number EngageMaxDistance Max engage distance of targets in meters. Default auto (*nil*).
|
-- @param #number EngageMaxDistance Max engage distance of targets in meters. Default auto (*nil*).
|
||||||
-- @param #table TargetTypes Types of targets to engage automatically. Default is {"Air"}, i.e. all enemy airborne units. Use an empty set {} for a simple "FOLLOW" mission.
|
-- @param #table TargetTypes Types of targets to engage automatically. Default is {"Air"}, i.e. all enemy airborne units. Use an empty set {} for a simple "FOLLOW" mission.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
@@ -1072,7 +1073,7 @@ function AUFTRAG:NewESCORT(EscortGroup, OffsetVector, EngageMaxDistance, TargetT
|
|||||||
mission:_TargetFromObject(EscortGroup)
|
mission:_TargetFromObject(EscortGroup)
|
||||||
|
|
||||||
-- DCS task parameters:
|
-- DCS task parameters:
|
||||||
mission.escortVec3=OffsetVector or {x=200, y=0, z=-100}
|
mission.escortVec3=OffsetVector or {x=-100, y=0, z=200}
|
||||||
mission.engageMaxDistance=EngageMaxDistance
|
mission.engageMaxDistance=EngageMaxDistance
|
||||||
mission.engageTargetTypes=TargetTypes or {"Air"}
|
mission.engageTargetTypes=TargetTypes or {"Air"}
|
||||||
|
|
||||||
@@ -2140,9 +2141,9 @@ function AUFTRAG:Evaluate()
|
|||||||
---
|
---
|
||||||
|
|
||||||
-- Check if failed.
|
-- Check if failed.
|
||||||
if self.type==AUFTRAG.Type.TROOPTRANSPORT then
|
if self.type==AUFTRAG.Type.TROOPTRANSPORT or self.type==AUFTRAG.Type.ESCORT then
|
||||||
|
|
||||||
-- Transported groups have to survive.
|
-- Transported or escorted groups have to survive.
|
||||||
if Ntargets<Ntargets0 then
|
if Ntargets<Ntargets0 then
|
||||||
failed=true
|
failed=true
|
||||||
end
|
end
|
||||||
@@ -3040,7 +3041,8 @@ end
|
|||||||
|
|
||||||
--- Get coordinate of target. First unit/group of the set is used.
|
--- Get coordinate of target. First unit/group of the set is used.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @return #string
|
-- @param #table MissionTypes A table of mission types.
|
||||||
|
-- @return #string Comma separated list of mission types.
|
||||||
function AUFTRAG:GetMissionTypesText(MissionTypes)
|
function AUFTRAG:GetMissionTypesText(MissionTypes)
|
||||||
|
|
||||||
local text=""
|
local text=""
|
||||||
@@ -3051,7 +3053,7 @@ function AUFTRAG:GetMissionTypesText(MissionTypes)
|
|||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the mission waypoint coordinate where the mission is executed. This is
|
--- Set the mission waypoint coordinate where the mission is executed.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @return Core.Point#COORDINATE Coordinate where the mission is executed.
|
-- @return Core.Point#COORDINATE Coordinate where the mission is executed.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
@@ -3065,8 +3067,13 @@ end
|
|||||||
-- @return Core.Point#COORDINATE Coordinate where the mission is executed.
|
-- @return Core.Point#COORDINATE Coordinate where the mission is executed.
|
||||||
function AUFTRAG:GetMissionWaypointCoord(group)
|
function AUFTRAG:GetMissionWaypointCoord(group)
|
||||||
|
|
||||||
|
-- Check if a coord has been explicitly set.
|
||||||
if self.missionWaypointCoord then
|
if self.missionWaypointCoord then
|
||||||
return self.missionWaypointCoord
|
local coord=self.missionWaypointCoord
|
||||||
|
if self.missionAltitude then
|
||||||
|
coord.y=self.missionAltitude
|
||||||
|
end
|
||||||
|
return coord
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create waypoint coordinate half way between us and the target.
|
-- Create waypoint coordinate half way between us and the target.
|
||||||
|
|||||||
@@ -2567,9 +2567,19 @@ function FLIGHTGROUP:_InitGroup()
|
|||||||
self:SetDefaultRadio(self.radio.Freq, self.radio.Modu, self.radio.On)
|
self:SetDefaultRadio(self.radio.Freq, self.radio.Modu, self.radio.On)
|
||||||
|
|
||||||
--TODO callsign from template or getCallsign
|
--TODO callsign from template or getCallsign
|
||||||
self.callsign.NumberSquad=self.template.units[1].callsign[1]
|
local callsign=self.template.units[1].callsign
|
||||||
self.callsign.NumberGroup=self.template.units[1].callsign[2]
|
env.info("FF callsign:",showMessageBox)
|
||||||
self.callsign.NumberElement=self.template.units[1].callsign[3] -- First element only
|
if type(callsign)=="number" then
|
||||||
|
local cs=tostring(callsign)
|
||||||
|
callsign={}
|
||||||
|
callsign[1]=cs:sub(1,1)
|
||||||
|
callsign[2]=cs:sub(2,2)
|
||||||
|
callsign[3]=cs:sub(3,3)
|
||||||
|
end
|
||||||
|
self:I({callsign=callsign})
|
||||||
|
self.callsign.NumberSquad=callsign[1]
|
||||||
|
self.callsign.NumberGroup=callsign[2]
|
||||||
|
self.callsign.NumberElement=callsign[3] -- First element only
|
||||||
self.callsign.NameSquad=UTILS.GetCallsignName(self.callsign.NumberSquad)
|
self.callsign.NameSquad=UTILS.GetCallsignName(self.callsign.NumberSquad)
|
||||||
|
|
||||||
-- Set default formation.
|
-- Set default formation.
|
||||||
|
|||||||
@@ -2472,8 +2472,6 @@ end
|
|||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
function OPSGROUP:_QueueUpdate()
|
function OPSGROUP:_QueueUpdate()
|
||||||
|
|
||||||
--env.info(self.lid.."FF queueupdate T="..timer.getTime())
|
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Mission
|
-- Mission
|
||||||
---
|
---
|
||||||
@@ -2741,7 +2739,7 @@ end
|
|||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function OPSGROUP:onafterDead(From, Event, To)
|
function OPSGROUP:onafterDead(From, Event, To)
|
||||||
self:T(self.lid..string.format("Group dead!"))
|
self:I(self.lid..string.format("Group dead!"))
|
||||||
|
|
||||||
-- Delete waypoints so they are re-initialized at the next spawn.
|
-- Delete waypoints so they are re-initialized at the next spawn.
|
||||||
self.waypoints=nil
|
self.waypoints=nil
|
||||||
@@ -2757,7 +2755,7 @@ function OPSGROUP:onafterDead(From, Event, To)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Stop in a sec.
|
-- Stop in a sec.
|
||||||
self:__Stop(-1)
|
self:__Stop(-5)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "Stop" event.
|
--- On after "Stop" event.
|
||||||
@@ -2775,7 +2773,8 @@ function OPSGROUP:onafterStop(From, Event, To)
|
|||||||
self.CallScheduler:Clear()
|
self.CallScheduler:Clear()
|
||||||
|
|
||||||
if self:IsAlive() then
|
if self:IsAlive() then
|
||||||
self:E(self.lid.."WARNING: Group is still alive! Use OPSGROUP:Destroy() or OPSGROUP:Despawn() for a clean stop")
|
local life, life0=self:GetLifePoints()
|
||||||
|
self:E(self.lid..string.format("WARNING: Group is still alive! Life points=%d/%d. Use OPSGROUP:Destroy() or OPSGROUP:Despawn() for a clean stop", life, life0))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
@@ -3982,7 +3981,8 @@ function OPSGROUP:_UpdatePosition()
|
|||||||
|
|
||||||
self.traveldist=self.traveldist+self.travelds
|
self.traveldist=self.traveldist+self.travelds
|
||||||
|
|
||||||
env.info(string.format("FF Traveled %.1f m", self.traveldist))
|
-- Debug info.
|
||||||
|
--env.info(string.format("FF Traveled %.1f m", self.traveldist))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user