diff --git a/Moose Development/Moose/Ops/AirWing.lua b/Moose Development/Moose/Ops/AirWing.lua index c8fbb1524..0dae8cb06 100644 --- a/Moose Development/Moose/Ops/AirWing.lua +++ b/Moose Development/Moose/Ops/AirWing.lua @@ -422,6 +422,44 @@ function AIRWING:SetPayloadAmount(Payload, Navailable) return self end +--- Increase or decrease the amount of available payloads. Unlimited playloads first need to be set to a limited number with the `SetPayloadAmount` function. +-- @param #AIRWING self +-- @param #AIRWING.Payload Payload The payload table created by the `:NewPayload` function. +-- @param #number N Number of payloads to be added. Use negative number to decrease amount. Default 1. +-- @return #AIRWING self +function AIRWING:IncreasePayloadAmount(Payload, N) + + N=N or 1 + + if Payload and Payload.navail>=0 then + + -- Increase/decrease amount. + Payload.navail=Payload.navail+N + + -- Ensure playload does not drop below 0. + Payload.navail=math.max(Payload.navail, 0) + + end + + return self +end + +--- Get amount of payloads available for a given playload. +-- @param #AIRWING self +-- @param #AIRWING.Payload Payload The payload table created by the `:NewPayload` function. +-- @return #number Number of payloads available. Unlimited payloads will return -1. +function AIRWING:GetPayloadAmount(Payload) + return Payload.navail +end + +--- Get capabilities of a given playload. +-- @param #AIRWING self +-- @param #AIRWING.Payload Payload The payload data table. +-- @return #table Capabilities. +function AIRWING:GetPayloadCapabilities(Payload) + return Payload.capabilities +end + --- Add a mission capability to an existing payload. -- @param #AIRWING self -- @param #AIRWING.Payload Payload The payload table to which the capability should be added. diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 313b8b154..118b9e642 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -5813,7 +5813,7 @@ function AIRBOSS:_ScanCarrierZone() if knownflight then -- Check if flight is AI and if we want to handle it at all. - if knownflight.ai and knownflight.flag == -100 and self.handleai and false then --Disabled AI handling because of incorrect OPSGROUP reference! + if knownflight.ai and knownflight.flag == -100 and self.handleai then local putintomarshal = false diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 6c5d0bf2f..1b63c2bbb 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -210,7 +210,7 @@ FLIGHTGROUP.Players={} --- FLIGHTGROUP class version. -- @field #string version -FLIGHTGROUP.version="0.8.0" +FLIGHTGROUP.version="0.8.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -372,11 +372,34 @@ end --- Get airwing the flight group belongs to. -- @param #FLIGHTGROUP self --- @return Ops.AirWing#AIRWING The AIRWING object. -function FLIGHTGROUP:GetAirWing() +-- @return Ops.AirWing#AIRWING The AIRWING object (if any). +function FLIGHTGROUP:GetAirwing() return self.legion end +--- Get name of airwing the flight group belongs to. +-- @param #FLIGHTGROUP self +-- @return #string Name of the airwing or "None" if the flightgroup does not belong to any airwing. +function FLIGHTGROUP:GetAirwing() + local name=self.legion and self.legion.alias or "None" + return name +end + +--- Get squadron the flight group belongs to. +-- @param #FLIGHTGROUP self +-- @return Ops.Squadron#SQUADRON The SQUADRON of this flightgroup or #nil if the flightgroup does not belong to any squadron. +function FLIGHTGROUP:GetSquadron() + return self.cohort +end + +--- Get squadron name the flight group belongs to. +-- @param #FLIGHTGROUP self +-- @return #string The squadron name or "None" if the flightgroup does not belon to any squadron. +function FLIGHTGROUP:GetSquadronName() + local name=self.cohort and self.cohort:GetName() or "None" + return name +end + --- Set if aircraft is VTOL capable. Unfortunately, there is no DCS way to determine this via scripting. -- @param #FLIGHTGROUP self -- @return #FLIGHTGROUP self @@ -836,6 +859,7 @@ end function FLIGHTGROUP:GetKills() return self.Nkills end + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Status ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/Moose Development/Moose/Ops/Legion.lua b/Moose Development/Moose/Ops/Legion.lua index 366d6a7d5..d2e0574e9 100644 --- a/Moose Development/Moose/Ops/Legion.lua +++ b/Moose Development/Moose/Ops/Legion.lua @@ -1854,7 +1854,7 @@ end --- Count total number of assets of the legion. -- @param #LEGION self --- @param #boolean InStock If true, only assets that are in the warehouse stock/inventory are counted. +-- @param #boolean InStock If `true`, only assets that are in the warehouse stock/inventory are counted. -- @param #table MissionTypes (Optional) Count only assest that can perform certain mission type(s). Default is all types. -- @param #table Attributes (Optional) Count only assest that have a certain attribute(s), e.g. `WAREHOUSE.Attribute.AIR_BOMBER`. -- @return #number Amount of asset groups in stock.