mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OPS
This commit is contained in:
@@ -345,10 +345,10 @@ end
|
|||||||
function ARMYGROUP:onbeforeStatus(From, Event, To)
|
function ARMYGROUP:onbeforeStatus(From, Event, To)
|
||||||
|
|
||||||
if self:IsDead() then
|
if self:IsDead() then
|
||||||
self:I(self.lid..string.format("Onbefore Status DEAD ==> false"))
|
self:T(self.lid..string.format("Onbefore Status DEAD ==> false"))
|
||||||
return false
|
return false
|
||||||
elseif self:IsStopped() then
|
elseif self:IsStopped() then
|
||||||
self:I(self.lid..string.format("Onbefore Status STOPPED ==> false"))
|
self:T(self.lid..string.format("Onbefore Status STOPPED ==> false"))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -567,16 +567,19 @@ function ARMYGROUP:onafterSpawned(From, Event, To)
|
|||||||
if not self.option.Formation then
|
if not self.option.Formation then
|
||||||
self.option.Formation=self.optionDefault.Formation
|
self.option.Formation=self.optionDefault.Formation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Update route.
|
||||||
|
if #self.waypoints>1 then
|
||||||
|
self:Cruise(nil, self.option.Formation or self.optionDefault.Formation)
|
||||||
|
else
|
||||||
|
self:FullStop()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Update status.
|
||||||
|
self:__Status(-0.1)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update route.
|
|
||||||
if #self.waypoints>1 then
|
|
||||||
self:Cruise(nil, self.option.Formation or self.optionDefault.Formation)
|
|
||||||
else
|
|
||||||
self:FullStop()
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On before "UpdateRoute" event.
|
--- On before "UpdateRoute" event.
|
||||||
@@ -1117,7 +1120,7 @@ function ARMYGROUP:_InitGroup()
|
|||||||
|
|
||||||
-- First check if group was already initialized.
|
-- First check if group was already initialized.
|
||||||
if self.groupinitialized then
|
if self.groupinitialized then
|
||||||
self:E(self.lid.."WARNING: Group was already initialized!")
|
self:T(self.lid.."WARNING: Group was already initialized! Will NOT do it again!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1177,7 +1180,7 @@ function ARMYGROUP:_InitGroup()
|
|||||||
self.actype=units[1]:GetTypeName()
|
self.actype=units[1]:GetTypeName()
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
if self.verbose>=0 then
|
if self.verbose>=1 then
|
||||||
local text=string.format("Initialized Army Group %s:\n", self.groupname)
|
local text=string.format("Initialized Army Group %s:\n", self.groupname)
|
||||||
text=text..string.format("Unit type = %s\n", self.actype)
|
text=text..string.format("Unit type = %s\n", self.actype)
|
||||||
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
|
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
|
||||||
|
|||||||
@@ -2191,7 +2191,7 @@ function FLIGHTGROUP:_CheckGroupDone(delay, waittime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Group is waiting.
|
-- Group is waiting.
|
||||||
if self.Twaiting then
|
if self:IsWaiting() then
|
||||||
self:T(self.lid.."Waiting! Group NOT done...")
|
self:T(self.lid.."Waiting! Group NOT done...")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -2531,37 +2531,31 @@ end
|
|||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate where to orbit. Default current position.
|
-- @param #number Duration Duration how long the group will be waiting in seconds. Default `nil` (=forever).
|
||||||
-- @param #number Altitude Altitude in feet. Default 10000 ft.
|
-- @param #number Altitude Altitude in feet. Default 10,000 ft for airplanes and 1,000 feet for helos.
|
||||||
-- @param #number Speed Speed in knots. Default 250 kts.
|
-- @param #number Speed Speed in knots. Default 250 kts for airplanes and 20 kts for helos.
|
||||||
function FLIGHTGROUP:onbeforeWait(From, Event, To, Coord, Altitude, Speed)
|
function FLIGHTGROUP:onbeforeWait(From, Event, To, Duration, Altitude, Speed)
|
||||||
|
|
||||||
local allowed=true
|
local allowed=true
|
||||||
local Tsuspend=nil
|
local Tsuspend=nil
|
||||||
|
|
||||||
-- Check if there are remaining tasks.
|
-- Check for a current task.
|
||||||
local Ntot,Nsched, Nwp=self:CountRemainingTasks()
|
|
||||||
|
|
||||||
if self.taskcurrent>0 then
|
if self.taskcurrent>0 then
|
||||||
self:I(self.lid..string.format("WARNING: Got current task ==> WAIT event is suspended for 10 sec."))
|
self:I(self.lid..string.format("WARNING: Got current task ==> WAIT event is suspended for 30 sec!"))
|
||||||
Tsuspend=-10
|
Tsuspend=-30
|
||||||
allowed=false
|
allowed=false
|
||||||
end
|
end
|
||||||
|
|
||||||
if Nsched>0 then
|
-- Check for a current transport assignment.
|
||||||
--self:I(self.lid..string.format("WARNING: Still got %d SCHEDULED tasks in the queue ==> WAIT event is suspended for 10 sec.", Nsched))
|
if self.cargoTransport then
|
||||||
--Tsuspend=-10
|
self:I(self.lid..string.format("WARNING: Got current TRANSPORT assignment ==> WAIT event is suspended for 30 sec!"))
|
||||||
--allowed=false
|
Tsuspend=-30
|
||||||
end
|
allowed=false
|
||||||
|
|
||||||
if Nwp>0 then
|
|
||||||
--self:I(self.lid..string.format("WARNING: Still got %d WAYPOINT tasks in the queue ==> WAIT event is suspended for 10 sec.", Nwp))
|
|
||||||
--Tsuspend=-10
|
|
||||||
--allowed=false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Call wait again.
|
||||||
if Tsuspend and not allowed then
|
if Tsuspend and not allowed then
|
||||||
self:__Wait(Tsuspend, Coord, Altitude, Speed)
|
self:__Wait(Tsuspend, Duration, Altitude, Speed)
|
||||||
end
|
end
|
||||||
|
|
||||||
return allowed
|
return allowed
|
||||||
@@ -2574,14 +2568,18 @@ end
|
|||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
-- @param #number Duration Duration how long the group will be waiting in seconds. Default `nil` (=forever).
|
-- @param #number Duration Duration how long the group will be waiting in seconds. Default `nil` (=forever).
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate where to orbit. Default current position.
|
-- @param #number Altitude Altitude in feet. Default 10,000 ft for airplanes and 1,000 feet for helos.
|
||||||
-- @param #number Altitude Altitude in feet. Default 10000 ft.
|
-- @param #number Speed Speed in knots. Default 250 kts for airplanes and 20 kts for helos.
|
||||||
-- @param #number Speed Speed in knots. Default 250 kts.
|
function FLIGHTGROUP:onafterWait(From, Event, To, Duration, Altitude, Speed)
|
||||||
function FLIGHTGROUP:onafterWait(From, Event, To, Duration, Coord, Altitude, Speed)
|
|
||||||
|
|
||||||
Coord=Coord or self.group:GetCoordinate()
|
-- Group will orbit at its current position.
|
||||||
|
local Coord=self.group:GetCoordinate()
|
||||||
|
|
||||||
|
-- Set altitude: 1000 ft for helos and 10,000 ft for panes.
|
||||||
Altitude=Altitude or (self.isHelo and 1000 or 10000)
|
Altitude=Altitude or (self.isHelo and 1000 or 10000)
|
||||||
Speed=Speed or (self.isHelo and 80 or 250)
|
|
||||||
|
-- Set speed.
|
||||||
|
Speed=Speed or (self.isHelo and 20 or 250)
|
||||||
|
|
||||||
-- Debug message.
|
-- Debug message.
|
||||||
local text=string.format("Flight group set to wait/orbit at altitude %d m and speed %.1f km/h", Altitude, Speed)
|
local text=string.format("Flight group set to wait/orbit at altitude %d m and speed %.1f km/h", Altitude, Speed)
|
||||||
@@ -3009,7 +3007,7 @@ function FLIGHTGROUP:_InitGroup()
|
|||||||
|
|
||||||
-- First check if group was already initialized.
|
-- First check if group was already initialized.
|
||||||
if self.groupinitialized then
|
if self.groupinitialized then
|
||||||
self:E(self.lid.."WARNING: Group was already initialized!")
|
self:T(self.lid.."WARNING: Group was already initialized! Will NOT do it again!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -3106,7 +3104,7 @@ function FLIGHTGROUP:_InitGroup()
|
|||||||
self.refueltype=select(2, unit:IsRefuelable())
|
self.refueltype=select(2, unit:IsRefuelable())
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
if self.verbose>=0 then
|
if self.verbose>=1 then
|
||||||
local text=string.format("Initialized Flight Group %s:\n", self.groupname)
|
local text=string.format("Initialized Flight Group %s:\n", self.groupname)
|
||||||
text=text..string.format("Unit type = %s\n", self.actype)
|
text=text..string.format("Unit type = %s\n", self.actype)
|
||||||
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
|
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
|
||||||
@@ -3606,27 +3604,6 @@ function FLIGHTGROUP:AddWaypointLanding(Airbase, Speed, AfterWaypointWithID, Alt
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Check if a unit is an element of the flightgroup.
|
|
||||||
-- @param #FLIGHTGROUP self
|
|
||||||
-- @param #string unitname Name of unit.
|
|
||||||
-- @return #boolean If true, unit is element of the flight group or false if otherwise.
|
|
||||||
function FLIGHTGROUP:_IsElement(unitname)
|
|
||||||
|
|
||||||
for _,_element in pairs(self.elements) do
|
|
||||||
local element=_element --Ops.OpsGroup#OPSGROUP.Element
|
|
||||||
|
|
||||||
if element.name==unitname then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Set parking spot of element.
|
--- Set parking spot of element.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element The element.
|
-- @param Ops.OpsGroup#OPSGROUP.Element Element The element.
|
||||||
|
|||||||
@@ -693,16 +693,19 @@ function NAVYGROUP:onafterSpawned(From, Event, To)
|
|||||||
else
|
else
|
||||||
self:SetDefaultRadio(self.radio.Freq, self.radio.Modu, false)
|
self:SetDefaultRadio(self.radio.Freq, self.radio.Modu, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Update route.
|
||||||
|
if #self.waypoints>1 then
|
||||||
|
self:Cruise()
|
||||||
|
else
|
||||||
|
self:FullStop()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Update status.
|
||||||
|
self:__Status(-0.1)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update route.
|
|
||||||
if #self.waypoints>1 then
|
|
||||||
self:Cruise()
|
|
||||||
else
|
|
||||||
self:FullStop()
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On before "UpdateRoute" event.
|
--- On before "UpdateRoute" event.
|
||||||
@@ -1132,7 +1135,7 @@ function NAVYGROUP:_InitGroup()
|
|||||||
|
|
||||||
-- First check if group was already initialized.
|
-- First check if group was already initialized.
|
||||||
if self.groupinitialized then
|
if self.groupinitialized then
|
||||||
self:E(self.lid.."WARNING: Group was already initialized!")
|
self:T(self.lid.."WARNING: Group was already initialized! Will NOT do it again!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1197,7 +1200,7 @@ function NAVYGROUP:_InitGroup()
|
|||||||
self.actype=units[1]:GetTypeName()
|
self.actype=units[1]:GetTypeName()
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
if self.verbose>=0 then
|
if self.verbose>=1 then
|
||||||
local text=string.format("Initialized Navy Group %s:\n", self.groupname)
|
local text=string.format("Initialized Navy Group %s:\n", self.groupname)
|
||||||
text=text..string.format("Unit type = %s\n", self.actype)
|
text=text..string.format("Unit type = %s\n", self.actype)
|
||||||
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
|
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ OPSGROUP.TaskType={
|
|||||||
-- @field #number MissilesAS Amount of anti-ship missiles.
|
-- @field #number MissilesAS Amount of anti-ship missiles.
|
||||||
-- @field #number MissilesCR Amount of cruise missiles.
|
-- @field #number MissilesCR Amount of cruise missiles.
|
||||||
-- @field #number MissilesBM Amount of ballistic missiles.
|
-- @field #number MissilesBM Amount of ballistic missiles.
|
||||||
|
-- @field #number MissilesSA Amount of surfe-to-air missiles.
|
||||||
|
|
||||||
--- Waypoint data.
|
--- Waypoint data.
|
||||||
-- @type OPSGROUP.Waypoint
|
-- @type OPSGROUP.Waypoint
|
||||||
@@ -1695,6 +1696,12 @@ end
|
|||||||
-- @return #boolean If true, the group exists or false if the group does not exist. If nil, the DCS group could not be found.
|
-- @return #boolean If true, the group exists or false if the group does not exist. If nil, the DCS group could not be found.
|
||||||
function OPSGROUP:IsActive()
|
function OPSGROUP:IsActive()
|
||||||
|
|
||||||
|
if self.group then
|
||||||
|
local active=self.group:IsActive()
|
||||||
|
return active
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if group is alive.
|
--- Check if group is alive.
|
||||||
@@ -1737,7 +1744,6 @@ end
|
|||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @return #boolean If true, all units/elements of the group are dead.
|
-- @return #boolean If true, all units/elements of the group are dead.
|
||||||
function OPSGROUP:IsDead()
|
function OPSGROUP:IsDead()
|
||||||
--env.info("FF IsDead")
|
|
||||||
if self.isDead then
|
if self.isDead then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -1806,6 +1812,16 @@ function OPSGROUP:IsEngaging()
|
|||||||
return is
|
return is
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if group is currently waiting.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @return #boolean If true, group is currently waiting.
|
||||||
|
function OPSGROUP:IsWaiting()
|
||||||
|
if self.Twaiting then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
--- Check if the group is not a carrier yet.
|
--- Check if the group is not a carrier yet.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @return #boolean If true, group is not a carrier.
|
-- @return #boolean If true, group is not a carrier.
|
||||||
@@ -1902,14 +1918,6 @@ function OPSGROUP:IsLoaded(CarrierGroupName)
|
|||||||
return self.cargoStatus==OPSGROUP.CargoStatus.LOADED
|
return self.cargoStatus==OPSGROUP.CargoStatus.LOADED
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the group is cargo and waiting for a carrier to pick it up.
|
|
||||||
-- @param #OPSGROUP self
|
|
||||||
-- @return #boolean If true, group is waiting for a carrier.
|
|
||||||
function OPSGROUP:IsWaitingAsCargo()
|
|
||||||
return self.cargoStatus==OPSGROUP.CargoStatus.WAITING
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Waypoint Functions
|
-- Waypoint Functions
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -3872,14 +3880,37 @@ end
|
|||||||
-- FSM Events
|
-- FSM Events
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- Check if group is currently waiting.
|
--- On before "Wait" event.
|
||||||
-- @param #OPSGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #boolean If true, group is currently waiting.
|
-- @param #string From From state.
|
||||||
function OPSGROUP:IsWaiting()
|
-- @param #string Event Event.
|
||||||
if self.Twaiting then
|
-- @param #string To To state.
|
||||||
return true
|
-- @param #number Duration Duration how long the group will be waiting in seconds. Default `nil` (=forever).
|
||||||
|
function OPSGROUP:onbeforeWait(From, Event, To, Duration)
|
||||||
|
|
||||||
|
local allowed=true
|
||||||
|
local Tsuspend=nil
|
||||||
|
|
||||||
|
-- Check for a current task.
|
||||||
|
if self.taskcurrent>0 then
|
||||||
|
self:I(self.lid..string.format("WARNING: Got current task ==> WAIT event is suspended for 30 sec!"))
|
||||||
|
Tsuspend=-30
|
||||||
|
allowed=false
|
||||||
end
|
end
|
||||||
return false
|
|
||||||
|
-- Check for a current transport assignment.
|
||||||
|
if self.cargoTransport then
|
||||||
|
self:I(self.lid..string.format("WARNING: Got current TRANSPORT assignment ==> WAIT event is suspended for 30 sec!"))
|
||||||
|
Tsuspend=-30
|
||||||
|
allowed=false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Call wait again.
|
||||||
|
if Tsuspend and not allowed then
|
||||||
|
self:__Wait(Tsuspend, Duration)
|
||||||
|
end
|
||||||
|
|
||||||
|
return allowed
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "Wait" event.
|
--- On after "Wait" event.
|
||||||
@@ -3991,7 +4022,6 @@ function OPSGROUP:_SetWaypointTasks(Waypoint)
|
|||||||
|
|
||||||
-- Check if there is mission task
|
-- Check if there is mission task
|
||||||
if missiontask then
|
if missiontask then
|
||||||
env.info("FF executing mission task")
|
|
||||||
self:TaskExecute(missiontask)
|
self:TaskExecute(missiontask)
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
@@ -4038,7 +4068,7 @@ function OPSGROUP:onafterGotoWaypoint(From, Event, To, UID)
|
|||||||
|
|
||||||
if n then
|
if n then
|
||||||
|
|
||||||
-- TODO: switch to re-enable waypoint tasks.
|
-- TODO: Switch to re-enable waypoint tasks?
|
||||||
if false then
|
if false then
|
||||||
local tasks=self:GetTasksWaypoint(n)
|
local tasks=self:GetTasksWaypoint(n)
|
||||||
|
|
||||||
@@ -4213,7 +4243,7 @@ function OPSGROUP:onbeforeLaserOn(From, Event, To, Target)
|
|||||||
self:LaserGotLOS()
|
self:LaserGotLOS()
|
||||||
else
|
else
|
||||||
-- Try to switch laser on again in 10 sec.
|
-- Try to switch laser on again in 10 sec.
|
||||||
self:I(self.lid.."LASER got no LOS currently. Trying to switch the laser on again in 10 sec")
|
self:T(self.lid.."LASER got no LOS currently. Trying to switch the laser on again in 10 sec")
|
||||||
self:__LaserOn(-10, Target)
|
self:__LaserOn(-10, Target)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -4697,7 +4727,6 @@ function OPSGROUP:onafterElementDead(From, Event, To, Element)
|
|||||||
|
|
||||||
|
|
||||||
-- Clear cargo bay of element.
|
-- Clear cargo bay of element.
|
||||||
--for _,_cargo in pairs(Element.cargoBay) do
|
|
||||||
for i=#Element.cargoBay,1,-1 do
|
for i=#Element.cargoBay,1,-1 do
|
||||||
local cargo=Element.cargoBay[i] --#OPSGROUP.MyCargo
|
local cargo=Element.cargoBay[i] --#OPSGROUP.MyCargo
|
||||||
|
|
||||||
@@ -4809,6 +4838,13 @@ function OPSGROUP:_Respawn(Delay, Template, Reset)
|
|||||||
-- Group is DESPAWNED
|
-- Group is DESPAWNED
|
||||||
---
|
---
|
||||||
|
|
||||||
|
-- Ensure elements in utero.
|
||||||
|
for _,_element in pairs(self.elements) do
|
||||||
|
local element=_element --#OPSGROUP.Element
|
||||||
|
self:ElementInUtero(element)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
|
||||||
-- Loop over template units.
|
-- Loop over template units.
|
||||||
@@ -4845,7 +4881,10 @@ function OPSGROUP:_Respawn(Delay, Template, Reset)
|
|||||||
-- Not dead or destroyed any more.
|
-- Not dead or destroyed any more.
|
||||||
self.isDead=false
|
self.isDead=false
|
||||||
self.isDestroyed=false
|
self.isDestroyed=false
|
||||||
self.Ndestroyed=0
|
self.Ndestroyed=0
|
||||||
|
|
||||||
|
self:InitWaypoints()
|
||||||
|
self:_InitGroup()
|
||||||
|
|
||||||
-- Reset events.
|
-- Reset events.
|
||||||
--self:ResetEvents()
|
--self:ResetEvents()
|
||||||
@@ -4919,10 +4958,17 @@ function OPSGROUP:onafterDead(From, Event, To)
|
|||||||
for i,_transport in pairs(self.cargoqueue) do
|
for i,_transport in pairs(self.cargoqueue) do
|
||||||
local transport=_transport --Ops.OpsTransport#OPSTRANSPORT
|
local transport=_transport --Ops.OpsTransport#OPSTRANSPORT
|
||||||
transport:__DeadCarrierGroup(1, self)
|
transport:__DeadCarrierGroup(1, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Cargo queue empty
|
||||||
|
self.cargoqueue={}
|
||||||
|
|
||||||
|
-- No current cargo transport.
|
||||||
|
self.cargoTransport=nil
|
||||||
|
|
||||||
|
|
||||||
-- Stop in a sec.
|
-- Stop in a sec.
|
||||||
self:__Stop(-5)
|
--self:__Stop(-5)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On before "Stop" event.
|
--- On before "Stop" event.
|
||||||
@@ -5343,6 +5389,7 @@ function OPSGROUP:_CheckDelivered(CargoTransport)
|
|||||||
elseif cargo.opsgroup==nil or cargo.opsgroup:IsDead() or cargo.opsgroup:IsStopped() then
|
elseif cargo.opsgroup==nil or cargo.opsgroup:IsDead() or cargo.opsgroup:IsStopped() then
|
||||||
-- This one is dead.
|
-- This one is dead.
|
||||||
else
|
else
|
||||||
|
--env.info(string.format())
|
||||||
done=false --Someone is not done!
|
done=false --Someone is not done!
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -5378,14 +5425,14 @@ end
|
|||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param Ops.OpsTransport#OPSTRANSPORT CargoTransport Cargo transport do be deleted.
|
-- @param Ops.OpsTransport#OPSTRANSPORT CargoTransport Cargo transport do be deleted.
|
||||||
-- @return #OPSGROUP self
|
-- @return #OPSGROUP self
|
||||||
function OPSGROUP:DelCargoTransport(CargoTransport)
|
function OPSGROUP:DelOpsTransport(CargoTransport)
|
||||||
|
|
||||||
for i,_transport in pairs(self.cargoqueue) do
|
for i=#self.cargoqueue,1,-1 do
|
||||||
local transport=_transport --Ops.OpsTransport#OPSTRANSPORT
|
local transport=self.cargoqueue[i] --Ops.OpsTransport#OPSTRANSPORT
|
||||||
if transport.uid==CargoTransport.uid then
|
if transport.uid==CargoTransport.uid then
|
||||||
table.remove(self.cargoqueue, i)
|
table.remove(self.cargoqueue, i)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -5574,7 +5621,7 @@ function OPSGROUP:AddWeightCargo(UnitName, Weight)
|
|||||||
|
|
||||||
local element=self:GetElementByName(UnitName)
|
local element=self:GetElementByName(UnitName)
|
||||||
|
|
||||||
if element and element.unit and element.unit:IsAlive() then
|
if element then --we do not check if the element is actually alive because we need to remove cargo from dead units
|
||||||
|
|
||||||
-- Add weight.
|
-- Add weight.
|
||||||
element.weightCargo=element.weightCargo+Weight
|
element.weightCargo=element.weightCargo+Weight
|
||||||
@@ -5767,7 +5814,7 @@ function OPSGROUP:onafterPickup(From, Event, To)
|
|||||||
|
|
||||||
-- We are already in the pickup zone ==> wait and initiate loading.
|
-- We are already in the pickup zone ==> wait and initiate loading.
|
||||||
if (self:IsArmygroup() or self:IsNavygroup()) and not self:IsHolding() then
|
if (self:IsArmygroup() or self:IsNavygroup()) and not self:IsHolding() then
|
||||||
self:Wait()
|
self:FullStop()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Start loading.
|
-- Start loading.
|
||||||
@@ -5992,7 +6039,7 @@ end
|
|||||||
function OPSGROUP:_TransferCargo(CargoGroup, CarrierGroup, CarrierElement)
|
function OPSGROUP:_TransferCargo(CargoGroup, CarrierGroup, CarrierElement)
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:I(self.lid..string.format("Transferring cargo %s to new carrier group %s", CargoGroup:GetName(), CarrierGroup:GetName()))
|
self:T(self.lid..string.format("Transferring cargo %s to new carrier group %s", CargoGroup:GetName(), CarrierGroup:GetName()))
|
||||||
|
|
||||||
-- Unload from this and directly load into the other carrier.
|
-- Unload from this and directly load into the other carrier.
|
||||||
self:Unload(CargoGroup)
|
self:Unload(CargoGroup)
|
||||||
@@ -6136,7 +6183,7 @@ function OPSGROUP:onafterTransport(From, Event, To)
|
|||||||
|
|
||||||
-- We are already in the pickup zone ==> wait and initiate unloading.
|
-- We are already in the pickup zone ==> wait and initiate unloading.
|
||||||
if (self:IsArmygroup() or self:IsNavygroup()) and not self:IsHolding() then
|
if (self:IsArmygroup() or self:IsNavygroup()) and not self:IsHolding() then
|
||||||
self:Wait()
|
self:FullStop()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Start loading.
|
-- Start loading.
|
||||||
@@ -6440,10 +6487,12 @@ function OPSGROUP:onafterUnload(From, Event, To, OpsGroup, Coordinate, Activated
|
|||||||
|
|
||||||
-- Add current waypoint. These have been cleard on loading.
|
-- Add current waypoint. These have been cleard on loading.
|
||||||
if OpsGroup:IsNavygroup() then
|
if OpsGroup:IsNavygroup() then
|
||||||
|
OpsGroup:ClearWaypoints()
|
||||||
OpsGroup.currentwp=1
|
OpsGroup.currentwp=1
|
||||||
OpsGroup.passedfinalwp=true
|
OpsGroup.passedfinalwp=true
|
||||||
NAVYGROUP.AddWaypoint(OpsGroup, Coordinate, nil, nil, nil, false)
|
NAVYGROUP.AddWaypoint(OpsGroup, Coordinate, nil, nil, nil, false)
|
||||||
elseif OpsGroup:IsArmygroup() then
|
elseif OpsGroup:IsArmygroup() then
|
||||||
|
OpsGroup:ClearWaypoints()
|
||||||
OpsGroup.currentwp=1
|
OpsGroup.currentwp=1
|
||||||
OpsGroup.passedfinalwp=true
|
OpsGroup.passedfinalwp=true
|
||||||
ARMYGROUP.AddWaypoint(OpsGroup, Coordinate, nil, nil, nil, false)
|
ARMYGROUP.AddWaypoint(OpsGroup, Coordinate, nil, nil, nil, false)
|
||||||
@@ -6555,7 +6604,7 @@ function OPSGROUP:onafterDelivered(From, Event, To, CargoTransport)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Remove cargo transport from cargo queue.
|
-- Remove cargo transport from cargo queue.
|
||||||
self:DelCargoTransport(CargoTransport)
|
self:DelOpsTransport(CargoTransport)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -6860,8 +6909,6 @@ function OPSGROUP:_CheckGroupDone(delay)
|
|||||||
-- Get current waypoint.
|
-- Get current waypoint.
|
||||||
local waypoint=self:GetWaypoint(self.currentwp)
|
local waypoint=self:GetWaypoint(self.currentwp)
|
||||||
|
|
||||||
--env.info("FF CheckGroupDone")
|
|
||||||
|
|
||||||
if waypoint then
|
if waypoint then
|
||||||
|
|
||||||
-- Number of tasks remaining for this waypoint.
|
-- Number of tasks remaining for this waypoint.
|
||||||
@@ -7437,7 +7484,7 @@ function OPSGROUP._PassingWaypoint(group, opsgroup, uid)
|
|||||||
|
|
||||||
else
|
else
|
||||||
-- Wait and load cargo.
|
-- Wait and load cargo.
|
||||||
opsgroup:Wait()
|
opsgroup:FullStop()
|
||||||
opsgroup:__Loading(-5)
|
opsgroup:__Loading(-5)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -7450,7 +7497,7 @@ function OPSGROUP._PassingWaypoint(group, opsgroup, uid)
|
|||||||
|
|
||||||
else
|
else
|
||||||
-- Stop and unload.
|
-- Stop and unload.
|
||||||
opsgroup:Wait()
|
opsgroup:FullStop()
|
||||||
opsgroup:Unloading()
|
opsgroup:Unloading()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -8521,7 +8568,7 @@ function OPSGROUP:_UpdateStatus(element, newstatus, airbase)
|
|||||||
---
|
---
|
||||||
|
|
||||||
if self:_AllSimilarStatus(newstatus) then
|
if self:_AllSimilarStatus(newstatus) then
|
||||||
self:__Dead(-1)
|
self:Dead()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -8678,8 +8725,6 @@ function OPSGROUP:_GetElementZoneLoader(Element, Zone, Loader)
|
|||||||
-- Heading in deg.
|
-- Heading in deg.
|
||||||
local heading=math.deg(math.atan2(X.z, X.x))
|
local heading=math.deg(math.atan2(X.z, X.x))
|
||||||
|
|
||||||
--env.info(string.format("FF l=%d w=%d h=%d", l, w, heading))
|
|
||||||
|
|
||||||
-- Bounding box at the origin of the map facing "North".
|
-- Bounding box at the origin of the map facing "North".
|
||||||
local b={}
|
local b={}
|
||||||
|
|
||||||
@@ -9035,6 +9080,24 @@ function OPSGROUP:_CoordinateFromObject(Object)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if a unit is an element of the flightgroup.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @param #string unitname Name of unit.
|
||||||
|
-- @return #boolean If true, unit is element of the flight group or false if otherwise.
|
||||||
|
function OPSGROUP:_IsElement(unitname)
|
||||||
|
|
||||||
|
for _,_element in pairs(self.elements) do
|
||||||
|
local element=_element --Ops.OpsGroup#OPSGROUP.Element
|
||||||
|
|
||||||
|
if element.name==unitname then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
--- Add a unit/element to the OPS group.
|
--- Add a unit/element to the OPS group.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param #string unitname Name of unit.
|
-- @param #string unitname Name of unit.
|
||||||
@@ -9095,7 +9158,7 @@ function OPSGROUP:_AddElementByName(unitname)
|
|||||||
element.weight=element.weightEmpty+element.weightCargo
|
element.weight=element.weightEmpty+element.weightCargo
|
||||||
|
|
||||||
-- Looks like only aircraft have a massMax value in the descriptors.
|
-- Looks like only aircraft have a massMax value in the descriptors.
|
||||||
element.weightMaxTotal=element.descriptors.massMax or element.weightEmpty+2*95 --If max mass is not given, we assume 10 soldiers.
|
element.weightMaxTotal=element.descriptors.massMax or element.weightEmpty+8*95 --If max mass is not given, we assume 8 soldiers.
|
||||||
|
|
||||||
|
|
||||||
if self.isArmygroup then
|
if self.isArmygroup then
|
||||||
@@ -9141,7 +9204,9 @@ function OPSGROUP:_AddElementByName(unitname)
|
|||||||
self:T(self.lid..text)
|
self:T(self.lid..text)
|
||||||
|
|
||||||
-- Add element to table.
|
-- Add element to table.
|
||||||
table.insert(self.elements, element)
|
if not self:_IsElement(unitname) then
|
||||||
|
table.insert(self.elements, element)
|
||||||
|
end
|
||||||
|
|
||||||
-- Trigger spawned event if alive.
|
-- Trigger spawned event if alive.
|
||||||
if unit:IsAlive() then
|
if unit:IsAlive() then
|
||||||
|
|||||||
@@ -208,8 +208,8 @@ function OPSTRANSPORT:New(GroupSet, Pickupzone, Deployzone)
|
|||||||
-- PLANNED --> SCHEDULED --> EXECUTING --> DELIVERED
|
-- PLANNED --> SCHEDULED --> EXECUTING --> DELIVERED
|
||||||
self:AddTransition("*", "Planned", OPSTRANSPORT.Status.PLANNED) -- Cargo transport was planned.
|
self:AddTransition("*", "Planned", OPSTRANSPORT.Status.PLANNED) -- Cargo transport was planned.
|
||||||
self:AddTransition(OPSTRANSPORT.Status.PLANNED, "Scheduled", OPSTRANSPORT.Status.SCHEDULED) -- Cargo is queued at at least one carrier.
|
self:AddTransition(OPSTRANSPORT.Status.PLANNED, "Scheduled", OPSTRANSPORT.Status.SCHEDULED) -- Cargo is queued at at least one carrier.
|
||||||
self:AddTransition(OPSTRANSPORT.Status.SCHEDULED, "Executing", OPSTRANSPORT.Status.EXECUTING) -- Cargo is being transported.
|
self:AddTransition(OPSTRANSPORT.Status.SCHEDULED, "Executing", OPSTRANSPORT.Status.EXECUTING) -- Cargo is being transported.
|
||||||
self:AddTransition(OPSTRANSPORT.Status.EXECUTING, "Delivered", OPSTRANSPORT.Status.DELIVERED) -- Cargo was delivered.
|
self:AddTransition("*", "Delivered", OPSTRANSPORT.Status.DELIVERED) -- Cargo was delivered.
|
||||||
|
|
||||||
self:AddTransition("*", "Status", "*")
|
self:AddTransition("*", "Status", "*")
|
||||||
self:AddTransition("*", "Stop", "*")
|
self:AddTransition("*", "Stop", "*")
|
||||||
@@ -885,7 +885,7 @@ end
|
|||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function OPSTRANSPORT:onafterPlanned(From, Event, To)
|
function OPSTRANSPORT:onafterPlanned(From, Event, To)
|
||||||
self:I(self.lid..string.format("New status %s", OPSTRANSPORT.Status.PLANNED))
|
self:T(self.lid..string.format("New status: %s-->%s", From, To))
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "Scheduled" event.
|
--- On after "Scheduled" event.
|
||||||
@@ -894,7 +894,7 @@ end
|
|||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function OPSTRANSPORT:onafterScheduled(From, Event, To)
|
function OPSTRANSPORT:onafterScheduled(From, Event, To)
|
||||||
self:I(self.lid..string.format("New status %s", OPSTRANSPORT.Status.SCHEDULED))
|
self:T(self.lid..string.format("New status: %s-->%s", From, To))
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "Executing" event.
|
--- On after "Executing" event.
|
||||||
@@ -903,7 +903,22 @@ end
|
|||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function OPSTRANSPORT:onafterExecuting(From, Event, To)
|
function OPSTRANSPORT:onafterExecuting(From, Event, To)
|
||||||
self:I(self.lid..string.format("New status %s", OPSTRANSPORT.Status.EXECUTING))
|
self:T(self.lid..string.format("New status: %s-->%s", From, To))
|
||||||
|
end
|
||||||
|
|
||||||
|
--- On before "Delivered" event.
|
||||||
|
-- @param #OPSTRANSPORT self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
function OPSTRANSPORT:onbeforeDelivered(From, Event, To)
|
||||||
|
|
||||||
|
-- Check that we do not call delivered again.
|
||||||
|
if From==OPSTRANSPORT.Status.DELIVERED then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "Delivered" event.
|
--- On after "Delivered" event.
|
||||||
@@ -912,7 +927,7 @@ end
|
|||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function OPSTRANSPORT:onafterDelivered(From, Event, To)
|
function OPSTRANSPORT:onafterDelivered(From, Event, To)
|
||||||
self:I(self.lid..string.format("New status %s", OPSTRANSPORT.Status.DELIVERED))
|
self:T(self.lid..string.format("New status: %s-->%s", From, To))
|
||||||
|
|
||||||
-- Inform all assigned carriers that cargo was delivered. They can have this in the queue or are currently processing this transport.
|
-- Inform all assigned carriers that cargo was delivered. They can have this in the queue or are currently processing this transport.
|
||||||
for _,_carrier in pairs(self.carriers) do
|
for _,_carrier in pairs(self.carriers) do
|
||||||
@@ -941,7 +956,7 @@ end
|
|||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
-- @param Ops.OpsGroup#OPSGROUP OpsGroupCargo OPSGROUP that was unloaded from a carrier.
|
-- @param Ops.OpsGroup#OPSGROUP OpsGroupCargo Cargo OPSGROUP that was unloaded from a carrier.
|
||||||
-- @param Ops.OpsGroup#OPSGROUP OpsGroupCarrier Carrier OPSGROUP that unloaded the cargo.
|
-- @param Ops.OpsGroup#OPSGROUP OpsGroupCarrier Carrier OPSGROUP that unloaded the cargo.
|
||||||
function OPSTRANSPORT:onafterUnloaded(From, Event, To, OpsGroupCargo, OpsGroupCarrier)
|
function OPSTRANSPORT:onafterUnloaded(From, Event, To, OpsGroupCargo, OpsGroupCarrier)
|
||||||
self:I(self.lid..string.format("Unloaded OPSGROUP %s", OpsGroupCargo:GetName()))
|
self:I(self.lid..string.format("Unloaded OPSGROUP %s", OpsGroupCargo:GetName()))
|
||||||
@@ -966,6 +981,7 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function OPSTRANSPORT:onafterDeadCarrierAll(From, Event, To)
|
function OPSTRANSPORT:onafterDeadCarrierAll(From, Event, To)
|
||||||
self:I(self.lid..string.format("ALL Carrier OPSGROUPs are dead! Setting stage to PLANNED if not all cargo was delivered."))
|
self:I(self.lid..string.format("ALL Carrier OPSGROUPs are dead! Setting stage to PLANNED if not all cargo was delivered."))
|
||||||
|
self:_CheckDelivered()
|
||||||
if not self:IsDelivered() then
|
if not self:IsDelivered() then
|
||||||
self:Planned()
|
self:Planned()
|
||||||
end
|
end
|
||||||
@@ -997,7 +1013,6 @@ function OPSTRANSPORT:_CheckDelivered()
|
|||||||
-- This one was destroyed.
|
-- This one was destroyed.
|
||||||
elseif cargo.opsgroup:IsDead() then
|
elseif cargo.opsgroup:IsDead() then
|
||||||
-- This one is dead.
|
-- This one is dead.
|
||||||
dead=false
|
|
||||||
elseif cargo.opsgroup:IsStopped() then
|
elseif cargo.opsgroup:IsStopped() then
|
||||||
-- This one is stopped.
|
-- This one is stopped.
|
||||||
dead=false
|
dead=false
|
||||||
@@ -1089,7 +1104,7 @@ function OPSTRANSPORT:FindTransferCarrierForCargo(CargoGroup, Zone)
|
|||||||
local carrierGroup=_carrier --Ops.OpsGroup#OPSGROUP
|
local carrierGroup=_carrier --Ops.OpsGroup#OPSGROUP
|
||||||
|
|
||||||
-- First check if carrier is alive and loading cargo.
|
-- First check if carrier is alive and loading cargo.
|
||||||
if carrierGroup and carrierGroup:IsAlive() and carrierGroup:IsLoading() then
|
if carrierGroup and carrierGroup:IsAlive() and (carrierGroup:IsLoading() or self.deployzone:IsInstanceOf("ZONE_AIRBASE")) then
|
||||||
|
|
||||||
-- Find an element of the group that has enough free space.
|
-- Find an element of the group that has enough free space.
|
||||||
carrier=carrierGroup:FindCarrierForCargo(CargoGroup)
|
carrier=carrierGroup:FindCarrierForCargo(CargoGroup)
|
||||||
@@ -1098,10 +1113,10 @@ function OPSTRANSPORT:FindTransferCarrierForCargo(CargoGroup, Zone)
|
|||||||
if Zone==nil or Zone:IsCoordinateInZone(carrier.unit:GetCoordinate()) then
|
if Zone==nil or Zone:IsCoordinateInZone(carrier.unit:GetCoordinate()) then
|
||||||
return carrier, carrierGroup
|
return carrier, carrierGroup
|
||||||
else
|
else
|
||||||
self:T3(self.lid.."Got transfer carrier but carrier not in zone (yet)!")
|
self:T2(self.lid.."Got transfer carrier but carrier not in zone (yet)!")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:T3(self.lid.."No transfer carrier available!")
|
self:T2(self.lid.."No transfer carrier available!")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -310,8 +310,7 @@ end
|
|||||||
|
|
||||||
--- Returns the @{DCS#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
|
--- Returns the @{DCS#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
|
||||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||||
-- @return DCS#Position The 3D position vectors of the POSITIONABLE.
|
-- @return DCS#Position The 3D position vectors of the POSITIONABLE or #nil if the groups not existing or alive.
|
||||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
|
||||||
function GROUP:GetPositionVec3() -- Overridden from POSITIONABLE:GetPositionVec3()
|
function GROUP:GetPositionVec3() -- Overridden from POSITIONABLE:GetPositionVec3()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@@ -340,8 +339,7 @@ end
|
|||||||
--
|
--
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
-- @return #boolean true if the group is alive and active.
|
-- @return #boolean true if the group is alive and active.
|
||||||
-- @return #boolean false if the group is alive but inactive.
|
-- @return #boolean false if the group is alive but inactive or #nil if the group does not exist anymore.
|
||||||
-- @return #nil if the group does not exist anymore.
|
|
||||||
function GROUP:IsAlive()
|
function GROUP:IsAlive()
|
||||||
self:F2( self.GroupName )
|
self:F2( self.GroupName )
|
||||||
|
|
||||||
@@ -363,8 +361,7 @@ end
|
|||||||
|
|
||||||
--- Returns if the group is activated.
|
--- Returns if the group is activated.
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
-- @return #boolean true if group is activated.
|
-- @return #boolean true if group is activated or #nil The group is not existing or alive.
|
||||||
-- @return #nil The group is not existing or alive.
|
|
||||||
function GROUP:IsActive()
|
function GROUP:IsActive()
|
||||||
self:F2( self.GroupName )
|
self:F2( self.GroupName )
|
||||||
|
|
||||||
@@ -412,7 +409,6 @@ function GROUP:Destroy( GenerateEvent, delay )
|
|||||||
self:F2( self.GroupName )
|
self:F2( self.GroupName )
|
||||||
|
|
||||||
if delay and delay>0 then
|
if delay and delay>0 then
|
||||||
--SCHEDULER:New(nil, GROUP.Destroy, {self, GenerateEvent}, delay)
|
|
||||||
self:ScheduleOnce(delay, GROUP.Destroy, self, GenerateEvent)
|
self:ScheduleOnce(delay, GROUP.Destroy, self, GenerateEvent)
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user