diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index fbcf05e45..7dfdfca49 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -1400,6 +1400,22 @@ do -- SET_GROUP return self 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. -- @param #SET_GROUP self -- @param Core.Zone#ZONE ZoneObject The Zone to be tested for. @@ -6411,6 +6427,21 @@ do -- SET_OPSGROUP return self 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. -- Note: The GROUP object in the SET_OPSGROUP collection will only be removed if the last unit is destroyed of the GROUP. diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index c4b916448..bcf8227e7 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -417,6 +417,9 @@ end -- @param Wrapper.Airbase#AIRBASE HomeAirbase The home airbase. -- @return #FLIGHTGROUP self function FLIGHTGROUP:SetHomebase(HomeAirbase) + if type(HomeAirbase)=="string" then + HomeAirbase=AIRBASE:FindByName(HomeAirbase) + end self.homebase=HomeAirbase return self end @@ -426,6 +429,9 @@ end -- @param Wrapper.Airbase#AIRBASE DestinationAirbase The destination airbase. -- @return #FLIGHTGROUP self function FLIGHTGROUP:SetDestinationbase(DestinationAirbase) + if type(DestinationAirbase)=="string" then + DestinationAirbase=AIRBASE:FindByName(DestinationAirbase) + end self.destbase=DestinationAirbase return self end @@ -730,7 +736,7 @@ function FLIGHTGROUP:StartUncontrolled(delay) end self:I(self.lid.."Starting uncontrolled group") self.group:StartUncontrolled(_delay) - self.isUncontrolled=true + self.isUncontrolled=false else self:E(self.lid.."ERROR: Could not start uncontrolled group as it is NOT alive!") end diff --git a/Moose Development/Moose/Ops/NavyGroup.lua b/Moose Development/Moose/Ops/NavyGroup.lua index 4f233faac..fb836d489 100644 --- a/Moose Development/Moose/Ops/NavyGroup.lua +++ b/Moose Development/Moose/Ops/NavyGroup.lua @@ -1005,7 +1005,7 @@ function NAVYGROUP:onafterDive(From, Event, To, Depth, Speed) 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 diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index 6f8412eb5..2792b93f5 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -5447,6 +5447,8 @@ function OPSGROUP:onafterPickup(From, Event, To) -- Add waypoint. if self.isFlightgroup then + + env.info("FF pickup is flightgroup") if airbasePickup then @@ -5461,10 +5463,13 @@ function OPSGROUP:onafterPickup(From, Event, To) -- Activate uncontrolled group. if self:IsParking() then + env.info("FF pickup start uncontrolled while parking at current airbase") self:StartUncontrolled() end else + + env.info("FF pickup land at airbase") -- Order group to land at an airbase. self:LandAtAirbase(airbasePickup) @@ -5477,6 +5482,14 @@ function OPSGROUP:onafterPickup(From, Event, To) -- 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. Coordinate:SetAltitude(200) local waypoint=FLIGHTGROUP.AddWaypoint(self, Coordinate) @@ -5485,6 +5498,7 @@ function OPSGROUP:onafterPickup(From, Event, To) else self:E(self.lid.."ERROR: Carrier aircraft cannot land in Pickup zone! Specify a ZONE_AIRBASE as pickup zone") end + elseif self.isNavygroup then -- Navy Group @@ -5656,8 +5670,11 @@ function OPSGROUP:onafterLoad(From, Event, To, CargoGroup, Carrier) CargoGroup:Despawn(0, true) end - -- Trigger embarked event. + -- Trigger embarked event for cargo group. CargoGroup:Embarked(self, Carrier) + + -- Trigger "Loaded" event for current cargo transport. + self.cargoTransport:Loaded(CargoGroup, Carrier) else self:E(self.lid.."ERROR: Cargo has no carrier on Load event!") diff --git a/Moose Development/Moose/Ops/OpsTransport.lua b/Moose Development/Moose/Ops/OpsTransport.lua index 92a9ff9ff..4eca27af6 100644 --- a/Moose Development/Moose/Ops/OpsTransport.lua +++ b/Moose Development/Moose/Ops/OpsTransport.lua @@ -415,6 +415,15 @@ function OPSTRANSPORT:SetPriority(Prio, Importance, Urgent) return self 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. -- @param #OPSTRANSPORT self -- @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 +--- 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. -- @param #OPSTRANSPORT self -- @param #string From From state.