This commit is contained in:
Frank 2021-06-22 12:18:25 +02:00
parent 6290db035d
commit 231c5bfea7
5 changed files with 77 additions and 3 deletions

View File

@ -1400,6 +1400,22 @@ do -- SET_GROUP
return self return self
end end
--- Activate late activated groups.
-- @param #SET_GROUP self
-- @param #number Delay Delay in seconds.
-- @return #SET_GROUP self
function SET_GROUP:Activate(Delay)
local Set = self:GetSet()
for GroupID, GroupData in pairs(Set) do -- For each GROUP in SET_GROUP
local group=GroupData --Wrapper.Group#GROUP
if group and group:IsAlive()==false then
group:Activate(Delay)
end
end
return self
end
--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence completely in a @{Zone}, providing the GROUP and optional parameters to the called function. --- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence completely in a @{Zone}, providing the GROUP and optional parameters to the called function.
-- @param #SET_GROUP self -- @param #SET_GROUP self
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for. -- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
@ -6411,6 +6427,21 @@ do -- SET_OPSGROUP
return self return self
end end
--- Activate late activated groups in the set.
-- @param #SET_OPSGROUP self
-- @param #number Delay Delay in seconds.
-- @return #SET_OPSGROUP self
function SET_OPSGROUP:Activate(Delay)
local Set = self:GetSet()
for GroupID, GroupData in pairs(Set) do
local group=GroupData --Ops.OpsGroup#OPSGROUP
if group and group:IsAlive()==false then
group:Activate(Delay)
end
end
return self
end
--- Handles the OnDead or OnCrash event for alive groups set. --- Handles the OnDead or OnCrash event for alive groups set.
-- Note: The GROUP object in the SET_OPSGROUP collection will only be removed if the last unit is destroyed of the GROUP. -- Note: The GROUP object in the SET_OPSGROUP collection will only be removed if the last unit is destroyed of the GROUP.

View File

@ -417,6 +417,9 @@ end
-- @param Wrapper.Airbase#AIRBASE HomeAirbase The home airbase. -- @param Wrapper.Airbase#AIRBASE HomeAirbase The home airbase.
-- @return #FLIGHTGROUP self -- @return #FLIGHTGROUP self
function FLIGHTGROUP:SetHomebase(HomeAirbase) function FLIGHTGROUP:SetHomebase(HomeAirbase)
if type(HomeAirbase)=="string" then
HomeAirbase=AIRBASE:FindByName(HomeAirbase)
end
self.homebase=HomeAirbase self.homebase=HomeAirbase
return self return self
end end
@ -426,6 +429,9 @@ end
-- @param Wrapper.Airbase#AIRBASE DestinationAirbase The destination airbase. -- @param Wrapper.Airbase#AIRBASE DestinationAirbase The destination airbase.
-- @return #FLIGHTGROUP self -- @return #FLIGHTGROUP self
function FLIGHTGROUP:SetDestinationbase(DestinationAirbase) function FLIGHTGROUP:SetDestinationbase(DestinationAirbase)
if type(DestinationAirbase)=="string" then
DestinationAirbase=AIRBASE:FindByName(DestinationAirbase)
end
self.destbase=DestinationAirbase self.destbase=DestinationAirbase
return self return self
end end
@ -730,7 +736,7 @@ function FLIGHTGROUP:StartUncontrolled(delay)
end end
self:I(self.lid.."Starting uncontrolled group") self:I(self.lid.."Starting uncontrolled group")
self.group:StartUncontrolled(_delay) self.group:StartUncontrolled(_delay)
self.isUncontrolled=true self.isUncontrolled=false
else else
self:E(self.lid.."ERROR: Could not start uncontrolled group as it is NOT alive!") self:E(self.lid.."ERROR: Could not start uncontrolled group as it is NOT alive!")
end end

View File

@ -1005,7 +1005,7 @@ function NAVYGROUP:onafterDive(From, Event, To, Depth, Speed)
Depth=Depth or 50 Depth=Depth or 50
self:T(self.lid..string.format("Diving to %d meters", Depth)) self:I(self.lid..string.format("Diving to %d meters", Depth))
self.depth=Depth self.depth=Depth

View File

@ -5447,6 +5447,8 @@ function OPSGROUP:onafterPickup(From, Event, To)
-- Add waypoint. -- Add waypoint.
if self.isFlightgroup then if self.isFlightgroup then
env.info("FF pickup is flightgroup")
if airbasePickup then if airbasePickup then
@ -5461,10 +5463,13 @@ function OPSGROUP:onafterPickup(From, Event, To)
-- Activate uncontrolled group. -- Activate uncontrolled group.
if self:IsParking() then if self:IsParking() then
env.info("FF pickup start uncontrolled while parking at current airbase")
self:StartUncontrolled() self:StartUncontrolled()
end end
else else
env.info("FF pickup land at airbase")
-- Order group to land at an airbase. -- Order group to land at an airbase.
self:LandAtAirbase(airbasePickup) self:LandAtAirbase(airbasePickup)
@ -5477,6 +5482,14 @@ function OPSGROUP:onafterPickup(From, Event, To)
-- Helo can also land in a zone (NOTE: currently VTOL cannot!) -- Helo can also land in a zone (NOTE: currently VTOL cannot!)
--- ---
env.info("FF pickup helo addwaypoint")
-- Activate uncontrolled group.
if self:IsParking() then
env.info("FF pickup start uncontrolled while parking airbase")
self:StartUncontrolled()
end
-- If this is a helo and no ZONE_AIRBASE was given, we make the helo land in the pickup zone. -- If this is a helo and no ZONE_AIRBASE was given, we make the helo land in the pickup zone.
Coordinate:SetAltitude(200) Coordinate:SetAltitude(200)
local waypoint=FLIGHTGROUP.AddWaypoint(self, Coordinate) local waypoint=FLIGHTGROUP.AddWaypoint(self, Coordinate)
@ -5485,6 +5498,7 @@ function OPSGROUP:onafterPickup(From, Event, To)
else else
self:E(self.lid.."ERROR: Carrier aircraft cannot land in Pickup zone! Specify a ZONE_AIRBASE as pickup zone") self:E(self.lid.."ERROR: Carrier aircraft cannot land in Pickup zone! Specify a ZONE_AIRBASE as pickup zone")
end end
elseif self.isNavygroup then elseif self.isNavygroup then
-- Navy Group -- Navy Group
@ -5656,8 +5670,11 @@ function OPSGROUP:onafterLoad(From, Event, To, CargoGroup, Carrier)
CargoGroup:Despawn(0, true) CargoGroup:Despawn(0, true)
end end
-- Trigger embarked event. -- Trigger embarked event for cargo group.
CargoGroup:Embarked(self, Carrier) CargoGroup:Embarked(self, Carrier)
-- Trigger "Loaded" event for current cargo transport.
self.cargoTransport:Loaded(CargoGroup, Carrier)
else else
self:E(self.lid.."ERROR: Cargo has no carrier on Load event!") self:E(self.lid.."ERROR: Cargo has no carrier on Load event!")

View File

@ -415,6 +415,15 @@ function OPSTRANSPORT:SetPriority(Prio, Importance, Urgent)
return self return self
end end
--- Set verbosity.
-- @param #OPSTRANSPORT self
-- @param #number Verbosity Be more verbose. Default 0
-- @return #OPSTRANSPORT self
function OPSTRANSPORT:SetVerbosity(Verbosity)
self.verbose=Verbosity or 0
return self
end
--- Add start condition. --- Add start condition.
-- @param #OPSTRANSPORT self -- @param #OPSTRANSPORT self
-- @param #function ConditionFunction Function that needs to be true before the transport can be started. Must return a #boolean. -- @param #function ConditionFunction Function that needs to be true before the transport can be started. Must return a #boolean.
@ -674,6 +683,17 @@ function OPSTRANSPORT:onafterDelivered(From, Event, To)
end end
--- On after "Loaded" event.
-- @param #OPSTRANSPORT self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Ops.OpsGroup#OPSGROUP OpsGroup OPSGROUP that was loaded into a carrier.
-- @param Ops.OpsGroup#OPSGROUP.Element Carrier Carrier element.
function OPSTRANSPORT:onafterLoaded(From, Event, To, OpsGroup, Carrier)
self:I(self.lid..string.format("Loaded OPSGROUP %s into carrier %s", OpsGroup:GetName(), tostring(Carrier.name)))
end
--- On after "Unloaded" event. --- On after "Unloaded" event.
-- @param #OPSTRANSPORT self -- @param #OPSTRANSPORT self
-- @param #string From From state. -- @param #string From From state.