Merge branch 'FF/Ops' into FF/OpsDev

This commit is contained in:
Frank
2025-11-15 10:14:15 +01:00
31 changed files with 4513 additions and 2595 deletions
@@ -2855,7 +2855,7 @@ do -- Route methods
-- @param Core.Zone#ZONE Zone The zone where to route to.
-- @param #boolean Randomize Defines whether to target point gets randomized within the Zone.
-- @param #number Speed The speed in m/s. Default is 5.555 m/s = 20 km/h.
-- @param Core.Base#FORMATION Formation The formation string.
-- @param DCS#FORMATION Formation The formation string.
function CONTROLLABLE:TaskRouteToZone( Zone, Randomize, Speed, Formation )
self:F2( Zone )
@@ -2915,7 +2915,7 @@ do -- Route methods
-- @param #CONTROLLABLE self
-- @param DCS#Vec2 Vec2 The Vec2 where to route to.
-- @param #number Speed The speed in m/s. Default is 5.555 m/s = 20 km/h.
-- @param Core.Base#FORMATION Formation The formation string.
-- @param DCS#FORMATION Formation The formation string.
function CONTROLLABLE:TaskRouteToVec2( Vec2, Speed, Formation )
local DCSControllable = self:GetDCSObject()
@@ -108,8 +108,9 @@ DYNAMICCARGO.State = {
-- @type DYNAMICCARGO.AircraftTypes
DYNAMICCARGO.AircraftTypes = {
["CH-47Fbl1"] = "CH-47Fbl1",
["Mi-8MTV2"] = "CH-47Fbl1",
["Mi-8MT"] = "CH-47Fbl1",
["Mi-8MTV2"] = "Mi-8MTV2",
["Mi-8MT"] = "Mi-8MT",
["C-130J-30"] = "C-130J-30",
}
--- Helo types possible.
@@ -122,23 +123,29 @@ DYNAMICCARGO.AircraftDimensions = {
["length"] = 11,
["ropelength"] = 30,
},
["Mi-8MTV2"] = {
["Mi-8MTV2"] = {
["width"] = 6,
["height"] = 6,
["length"] = 15,
["ropelength"] = 30,
},
["Mi-8MT"] = {
["Mi-8MT"] = {
["width"] = 6,
["height"] = 6,
["length"] = 15,
["ropelength"] = 30,
},
["C-130J-30"] = {
["width"] = 4,
["height"] = 12,
["length"] = 35,
["ropelength"] = 0,
},
}
--- DYNAMICCARGO class version.
-- @field #string version
DYNAMICCARGO.version="0.0.9"
DYNAMICCARGO.version="0.1.0"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -527,7 +534,10 @@ function DYNAMICCARGO:_UpdatePosition()
---------------
-- REMOVED Cargo
---------------
if self.timer and self.timer:IsRunning() then self.timer:Stop() end
if self.timer and self.timer:IsRunning() then
self.timer:Stop()
self.timer=nil
end
self:T(self.lid.." dead! " ..self.CargoState.."-> REMOVED")
self.CargoState = DYNAMICCARGO.State.REMOVED
_DATABASE:CreateEventDynamicCargoRemoved(self)
@@ -535,6 +545,24 @@ function DYNAMICCARGO:_UpdatePosition()
return self
end
--- [USER] Destroy a DYNAMICCARGO object.
-- @param #DYNAMICCARGO self
-- @param #boolean GenerateEvent Set to false to remove an item silently. Defaults to true.
-- @return #boolean Return Returns nil if the object could not be found, else returns true.
function DYNAMICCARGO:Destroy(GenerateEvent)
local DCSObject = self:GetDCSObject()
if DCSObject then
local GenerateEvent = (GenerateEvent ~= nil and GenerateEvent == false) and false or true
if GenerateEvent and GenerateEvent == true then
self:CreateEventDead( timer.getTime(), DCSObject )
end
DCSObject:destroy()
self:_UpdatePosition()
return true
end
return nil
end
--- [Internal] Track helos for loaded/unloaded decision making.
-- @param Wrapper.Client#CLIENT client
-- @return #boolean IsIn
+41 -12
View File
@@ -1058,9 +1058,12 @@ function GROUP:GetTypeName()
local DCSGroup = self:GetDCSObject()
if DCSGroup then
local GroupTypeName = DCSGroup:getUnit(1):getTypeName()
--self:T3( GroupTypeName )
return( GroupTypeName )
local unit = DCSGroup:getUnit(1)
if unit then
local GroupTypeName = unit:getTypeName()
--self:T3( GroupTypeName )
return( GroupTypeName )
end
end
return nil
@@ -1075,9 +1078,12 @@ function GROUP:GetNatoReportingName()
local DCSGroup = self:GetDCSObject()
if DCSGroup then
local GroupTypeName = DCSGroup:getUnit(1):getTypeName()
--self:T3( GroupTypeName )
return UTILS.GetReportingName(GroupTypeName)
local unit = DCSGroup:getUnit(1)
if unit then
local GroupTypeName = unit:getTypeName()
--self:T3( GroupTypeName )
return UTILS.GetReportingName(GroupTypeName)
end
end
return "Bogey"
@@ -1093,9 +1099,12 @@ function GROUP:GetPlayerName()
local DCSGroup = self:GetDCSObject()
if DCSGroup then
local PlayerName = DCSGroup:getUnit(1):getPlayerName()
--self:T3( PlayerName )
return( PlayerName )
local unit = DCSGroup:getUnit(1)
if unit then
local PlayerName = unit:getPlayerName()
--self:T3( PlayerName )
return( PlayerName )
end
end
return nil
@@ -1111,9 +1120,12 @@ function GROUP:GetCallsign()
local DCSGroup = self:GetDCSObject()
if DCSGroup then
local GroupCallSign = DCSGroup:getUnit(1):getCallsign()
--self:T3( GroupCallSign )
return GroupCallSign
local unit = DCSGroup:getUnit(1)
if unit then
local GroupCallSign = unit:getCallsign()
--self:T3( GroupCallSign )
return GroupCallSign
end
end
BASE:E( { "Cannot GetCallsign", Positionable = self, Alive = self:IsAlive() } )
@@ -1152,6 +1164,23 @@ function GROUP:GetVec3()
return nil
end
--- Returns the current {@Core.Vector#VECTOR} of the first Unit in the GROUP.
-- @param #GROUP self
-- @return Core.Vector#VECTOR Vector of the first Unit of the GROUP or nil if cannot be found.
function GROUP:GetVector()
-- Get first unit.
local unit=self:GetUnit(1)
if unit then
local vector=unit:GetVector()
return vector
end
self:E("ERROR: Cannot get Vector of group "..tostring(self.GroupName))
return nil
end
--- Returns the average Vec3 vector of the Units in the GROUP.
-- @param #GROUP self
-- @return DCS#Vec3 Current Vec3 of the GROUP or nil if cannot be found.
@@ -170,6 +170,27 @@ function IDENTIFIABLE:GetCoalition()
return nil
end
--- Returns true if identifiable is of RED coalition.
-- @param #IDENTIFIABLE self
-- @return #boolean If the identifiable is red.
function IDENTIFIABLE:IsRed()
return self:GetCoalition() == coalition.side.RED
end
--- Returns true if identifiable is of BLUE coalition.
-- @param #IDENTIFIABLE self
-- @return #boolean If the identifiable is blue.
function IDENTIFIABLE:IsBlue()
return self:GetCoalition() == coalition.side.BLUE
end
--- Returns true if identifiable is of NEUTRAL coalition.
-- @param #IDENTIFIABLE self
-- @return #boolean If the identifiable is neutral.
function IDENTIFIABLE:IsNeutral()
return self:GetCoalition() == coalition.side.NEUTRAL
end
--- Returns the name of the coalition of the Identifiable.
-- @param #IDENTIFIABLE self
-- @return #string The name of the coalition.
@@ -219,6 +219,25 @@ function POSITIONABLE:GetOrientationZ()
end
end
--- Returns the vectors of the orientation of the object:
-- X is the orientation parallel to the movement of the object, Z perpendicular and Y vertical orientation.
-- @param #POSITIONABLE self
-- @return Core.Vector#VECTOR X orientation, i.e. parallel to the direction of movement.
-- @return Core.Vector#VECTOR Y orientation, i.e. vertical.
-- @return Core.Vector#VECTOR Z orientation, i.e. perpendicular to the direction of movement.
function POSITIONABLE:GetOrientationVectors()
local position = self:GetPosition()
if position then
local vecx=VECTOR:NewFromVec(position.x)
local vecy=VECTOR:NewFromVec(position.y)
local vecz=VECTOR:NewFromVec(position.z)
return vecx, vecy, vecz
else
BASE:E( { "Cannot GetOrientation", Positionable = self, Alive = self:IsAlive() } )
return nil, nil, nil
end
end
--- Returns the @{DCS#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
-- @param #POSITIONABLE self
-- @return DCS#Position The 3D position vectors of the POSITIONABLE.
@@ -286,6 +305,27 @@ function POSITIONABLE:GetVec2()
return nil
end
--- Returns the @{Core.Vector#VECTOR} indicating the 3D position of the object on the map.
-- @param #POSITIONABLE self
-- @return Core.Vector#VECTOR The 3D vector.
function POSITIONABLE:GetVector()
local DCSPositionable = self:GetDCSObject()
if DCSPositionable then
local Vec3 = DCSPositionable:getPoint() -- DCS#Vec3
local vector=VECTOR:NewFromVec(Vec3)
return vector
end
self:E( { "Cannot GetVec2", Positionable = self, Alive = self:IsAlive() } )
return nil
end
--- Returns a COORDINATE object indicating the point in 2D of the POSITIONABLE within the mission.
-- @param #POSITIONABLE self
-- @return Core.Point#COORDINATE The 3D point vector of the POSITIONABLE.
@@ -914,6 +954,24 @@ function POSITIONABLE:GetVelocityVec3()
return nil
end
--- Returns the velocity vector.
-- @param #POSITIONABLE self
-- @return Core.Vector#VECTOR The velocity vector or `nil` if the object does not exist.
function POSITIONABLE:GetVelocityVector()
local DCSPositionable = self:GetDCSObject()
if DCSPositionable and DCSPositionable:isExist() then
local vec3 = DCSPositionable:getVelocity()
local vector=VECTOR:NewFromVec(vec3)
return vector
end
BASE:E( { "Cannot GetVelocityVector", Positionable = self, Alive = self:IsAlive() } )
return nil
end
--- Get relative velocity with respect to another POSITIONABLE.
-- @param #POSITIONABLE self
-- @param #POSITIONABLE Positionable Other POSITIONABLE.
@@ -1865,6 +1923,7 @@ do -- Cargo
["HL_DSHK"] = 6*POSITIONABLE.DefaultInfantryWeight,
["CCKW_353"] = 16*POSITIONABLE.DefaultInfantryWeight, --GMC CCKW 2½-ton 6×6 truck, estimating 16 soldiers,
["MaxxPro_MRAP"] = 7*POSITIONABLE.DefaultInfantryWeight,
["Sd_Kfz_251"] = 10*POSITIONABLE.DefaultInfantryWeight,
}
}
@@ -64,6 +64,9 @@ function STATIC:Register( StaticName )
else
self:E(string.format("Static object %s does not exist!", tostring(self.StaticName)))
end
-- Cache position
self._vec3 = self:GetVec3()
return self
end
@@ -86,6 +89,30 @@ function STATIC:GetLife()
return nil
end
--- Get the position of the STATIC even if it is not alive.
-- @param #STATIC self
-- @return DCS#Vec2 The 2D point vector of the POSITIONABLE.
-- @return #nil The position was not cached.
function STATIC:GetVec2Cached()
local vec2 = self:GetVec2()
if not vec2 and self._vec3 then
vec2 = {x = self._vec3.x, y = self._vec3.z }
end
return vec2
end
--- Get the position of the STATIC even if it is not alive.
-- @param #STATIC self
-- @return DCS#Vec3 The 3D point vector of the POSITIONABLE.
-- @return #nil The position was not cached.
function STATIC:GetVec3Cached()
local vec3 = self:GetVec3()
if not vec3 and self._vec3 then
vec3 = self._vec3
end
return vec3
end
--- Finds a STATIC from the _DATABASE using a DCSStatic object.
-- @param #STATIC self
-- @param DCS#StaticObject DCSStatic An existing DCS Static object reference.
@@ -232,6 +259,8 @@ function STATIC:SpawnAt(Coordinate, Heading, Delay)
local SpawnStatic=SPAWNSTATIC:NewFromStatic(self.StaticName)
SpawnStatic:SpawnFromPointVec2( Coordinate, Heading, self.StaticName )
-- Cache position
self._vec3 = self:GetVec3()
end
@@ -255,6 +284,8 @@ function STATIC:ReSpawn(CountryID, Delay)
local SpawnStatic=SPAWNSTATIC:NewFromStatic(self.StaticName, CountryID)
SpawnStatic:Spawn(nil, self.StaticName)
-- Cache position
self._vec3 = self:GetVec3()
end
@@ -278,6 +309,8 @@ function STATIC:ReSpawnAt(Coordinate, Heading, Delay)
local SpawnStatic=SPAWNSTATIC:NewFromStatic(self.StaticName, self:GetCountry())
SpawnStatic:SpawnFromCoordinate(Coordinate, Heading, self.StaticName)
-- Cache position
self._vec3 = self:GetVec3()
end