mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #1174 from FlightControl-Master/FF/Develop
MISC Fixes and Improvements
This commit is contained in:
commit
ab1ba9595d
@ -1095,7 +1095,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ParkDefender( Squadron, Defender )
|
self:ParkDefender( Squadron )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||||
@ -1122,7 +1122,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ParkDefender( Squadron, Defender )
|
self:ParkDefender( Squadron )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2873,7 +2873,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
if Dispatcher:GetSquadronLanding( Squadron.Name ) == AI_A2A_DISPATCHER.Landing.NearAirbase then
|
if Dispatcher:GetSquadronLanding( Squadron.Name ) == AI_A2A_DISPATCHER.Landing.NearAirbase then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
Defender:Destroy()
|
Defender:Destroy()
|
||||||
self:ParkDefender( Squadron, Defender )
|
Dispatcher:ParkDefender( Squadron )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -3060,7 +3060,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
if Dispatcher:GetSquadronLanding( Squadron.Name ) == AI_A2A_DISPATCHER.Landing.NearAirbase then
|
if Dispatcher:GetSquadronLanding( Squadron.Name ) == AI_A2A_DISPATCHER.Landing.NearAirbase then
|
||||||
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
Dispatcher:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
Defender:Destroy()
|
Defender:Destroy()
|
||||||
self:ParkDefender( Squadron, Defender )
|
Dispatcher:ParkDefender( Squadron )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end -- if DefenderGCI then
|
end -- if DefenderGCI then
|
||||||
|
|||||||
@ -1102,7 +1102,7 @@ function AI_FORMATION:onenterFollowing( FollowGroupSet ) --R2.1
|
|||||||
|
|
||||||
if FollowGroup:GetState( FollowGroup, "Mode" ) == self.__Enum.Mode.Formation then
|
if FollowGroup:GetState( FollowGroup, "Mode" ) == self.__Enum.Mode.Formation then
|
||||||
|
|
||||||
self:I({Mode=FollowGroup:GetState( FollowGroup, "Mode" )})
|
self:T({Mode=FollowGroup:GetState( FollowGroup, "Mode" )})
|
||||||
|
|
||||||
FollowGroup:OptionROTEvadeFire()
|
FollowGroup:OptionROTEvadeFire()
|
||||||
FollowGroup:OptionROEReturnFire()
|
FollowGroup:OptionROEReturnFire()
|
||||||
|
|||||||
@ -1571,6 +1571,35 @@ do -- SET_GROUP
|
|||||||
return Count
|
return Count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Iterate the SET_GROUP and count how many GROUPs and UNITs are alive.
|
||||||
|
-- @param #SET_GROUP self
|
||||||
|
-- @return #number The number of GROUPs completely in the Zone
|
||||||
|
-- @return #number The number of UNITS alive.
|
||||||
|
function SET_GROUP:CountAlive()
|
||||||
|
local CountG = 0
|
||||||
|
local CountU = 0
|
||||||
|
|
||||||
|
local Set = self:GetSet()
|
||||||
|
|
||||||
|
for GroupID, GroupData in pairs(Set) do -- For each GROUP in SET_GROUP
|
||||||
|
if GroupData and GroupData:IsAlive() then
|
||||||
|
|
||||||
|
CountG = CountG + 1
|
||||||
|
|
||||||
|
--Count Units.
|
||||||
|
for _,_unit in pairs(GroupData:GetUnits()) do
|
||||||
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
|
if unit and unit:IsAlive() then
|
||||||
|
CountU=CountU+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return CountG,CountU
|
||||||
|
end
|
||||||
|
|
||||||
----- Iterate the SET_GROUP and call an interator function for each **alive** player, providing the Group of the player and optional parameters.
|
----- Iterate the SET_GROUP and call an interator function for each **alive** player, providing the Group of the player and optional parameters.
|
||||||
---- @param #SET_GROUP self
|
---- @param #SET_GROUP self
|
||||||
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a GROUP parameter.
|
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a GROUP parameter.
|
||||||
|
|||||||
@ -127,6 +127,39 @@ do
|
|||||||
-- @param #number LaserCode Laser code.
|
-- @param #number LaserCode Laser code.
|
||||||
-- @param #number Duration Duration of lasing in seconds.
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
|
|
||||||
|
self:AddTransition( "Off", "LaseOnCoordinate", "On" )
|
||||||
|
|
||||||
|
--- LaseOnCoordinate Handler OnBefore for SPOT.
|
||||||
|
-- @function [parent=#SPOT] OnBeforeLaseOnCoordinate
|
||||||
|
-- @param #SPOT self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
-- @return #boolean
|
||||||
|
|
||||||
|
--- LaseOnCoordinate Handler OnAfter for SPOT.
|
||||||
|
-- @function [parent=#SPOT] OnAfterLaseOnCoordinate
|
||||||
|
-- @param #SPOT self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
|
||||||
|
--- LaseOnCoordinate Trigger for SPOT.
|
||||||
|
-- @function [parent=#SPOT] LaseOnCoordinate
|
||||||
|
-- @param #SPOT self
|
||||||
|
-- @param Core.Point#COORDINATE Coordinate The coordinate to lase.
|
||||||
|
-- @param #number LaserCode Laser code.
|
||||||
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
|
|
||||||
|
--- LaseOn Asynchronous Trigger for SPOT
|
||||||
|
-- @function [parent=#SPOT] __LaseOn
|
||||||
|
-- @param #SPOT self
|
||||||
|
-- @param #number Delay
|
||||||
|
-- @param Wrapper.Positionable#POSITIONABLE Target
|
||||||
|
-- @param #number LaserCode Laser code.
|
||||||
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self:AddTransition( "On", "Lasing", "On" )
|
self:AddTransition( "On", "Lasing", "On" )
|
||||||
self:AddTransition( { "On", "Destroyed" } , "LaseOff", "Off" )
|
self:AddTransition( { "On", "Destroyed" } , "LaseOff", "Off" )
|
||||||
@ -194,7 +227,8 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #SPOT self
|
--- On after LaseOn event. Activates the laser spot.
|
||||||
|
-- @param #SPOT self
|
||||||
-- @param From
|
-- @param From
|
||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
@ -227,6 +261,43 @@ do
|
|||||||
self:__Lasing( -1 )
|
self:__Lasing( -1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- On after LaseOnCoordinate event. Activates the laser spot.
|
||||||
|
-- @param #SPOT self
|
||||||
|
-- @param From
|
||||||
|
-- @param Event
|
||||||
|
-- @param To
|
||||||
|
-- @param Core.Point#COORDINATE Coordinate The coordinate at which the laser is pointing.
|
||||||
|
-- @param #number LaserCode Laser code.
|
||||||
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
|
function SPOT:onafterLaseOnCoordinate(From, Event, To, Coordinate, LaserCode, Duration)
|
||||||
|
self:F( { "LaseOnCoordinate", Coordinate, LaserCode, Duration } )
|
||||||
|
|
||||||
|
local function StopLase( self )
|
||||||
|
self:LaseOff()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Target = nil
|
||||||
|
self.TargetCoord=Coordinate
|
||||||
|
self.LaserCode = LaserCode
|
||||||
|
|
||||||
|
self.Lasing = true
|
||||||
|
|
||||||
|
local RecceDcsUnit = self.Recce:GetDCSObject()
|
||||||
|
|
||||||
|
local aimat=Coordinate
|
||||||
|
aimat.y=aimat.y+1
|
||||||
|
|
||||||
|
self.SpotIR = Spot.createInfraRed( RecceDcsUnit, { x = 0, y = 2, z = 0 }, aimat:GetVec3() )
|
||||||
|
self.SpotLaser = Spot.createLaser( RecceDcsUnit, { x = 0, y = 2, z = 0 }, aimat:GetVec3(), LaserCode )
|
||||||
|
|
||||||
|
if Duration then
|
||||||
|
self.ScheduleID = self.LaseScheduler:Schedule( self, StopLase, {self}, Duration )
|
||||||
|
end
|
||||||
|
|
||||||
|
self:__Lasing(-1)
|
||||||
|
end
|
||||||
|
|
||||||
--- @param #SPOT self
|
--- @param #SPOT self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function SPOT:OnEventDead(EventData)
|
function SPOT:OnEventDead(EventData)
|
||||||
@ -246,9 +317,19 @@ do
|
|||||||
-- @param To
|
-- @param To
|
||||||
function SPOT:onafterLasing( From, Event, To )
|
function SPOT:onafterLasing( From, Event, To )
|
||||||
|
|
||||||
if self.Target:IsAlive() then
|
if self.Target and self.Target:IsAlive() then
|
||||||
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/100):AddX(math.random(-100,100)/100):GetVec3() )
|
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/100):AddX(math.random(-100,100)/100):GetVec3() )
|
||||||
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
|
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
|
||||||
|
self:__Lasing( -0.2 )
|
||||||
|
elseif self.TargetCoord then
|
||||||
|
|
||||||
|
local aimat=self.TargetCoord --Core.Point#COORDINATE
|
||||||
|
aimat.y=aimat.y+1+math.random(-100,100)/100
|
||||||
|
aimat.x=aimat.x+math.random(-100,100)/100
|
||||||
|
|
||||||
|
self.SpotIR:setPoint(aimat:GetVec3())
|
||||||
|
self.SpotLaser:setPoint(self.TargetCoord:GetVec3())
|
||||||
|
|
||||||
self:__Lasing( -0.2 )
|
self:__Lasing( -0.2 )
|
||||||
else
|
else
|
||||||
self:F( { "Target is not alive", self.Target:IsAlive() } )
|
self:F( { "Target is not alive", self.Target:IsAlive() } )
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -541,7 +541,8 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.DetectionCount = self.DetectionSet:Count()
|
-- Count alive(!) groups only. Solves issue #1173 https://github.com/FlightControl-Master/MOOSE/issues/1173
|
||||||
|
self.DetectionCount = self.DetectionSet:CountAlive()
|
||||||
|
|
||||||
self.DetectionSet:ForEachGroupAlive(
|
self.DetectionSet:ForEachGroupAlive(
|
||||||
function( DetectionGroup )
|
function( DetectionGroup )
|
||||||
|
|||||||
@ -77,6 +77,8 @@
|
|||||||
-- @field #boolean safeparking If true, parking spots for aircraft are considered as occupied if e.g. a client aircraft is parked there. Default false.
|
-- @field #boolean safeparking If true, parking spots for aircraft are considered as occupied if e.g. a client aircraft is parked there. Default false.
|
||||||
-- @field #boolean isunit If true, warehouse is represented by a unit instead of a static.
|
-- @field #boolean isunit If true, warehouse is represented by a unit instead of a static.
|
||||||
-- @field #number lowfuelthresh Low fuel threshold. Triggers the event AssetLowFuel if for any unit fuel goes below this number.
|
-- @field #number lowfuelthresh Low fuel threshold. Triggers the event AssetLowFuel if for any unit fuel goes below this number.
|
||||||
|
-- @field #boolean respawnafterdestroyed If true, warehouse is respawned after it was destroyed. Assets are kept.
|
||||||
|
-- @field #number respawndelay Delay before respawn in seconds.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- Have your assets at the right place at the right time - or not!
|
--- Have your assets at the right place at the right time - or not!
|
||||||
@ -1569,6 +1571,8 @@ WAREHOUSE = {
|
|||||||
saveparking = false,
|
saveparking = false,
|
||||||
isunit = false,
|
isunit = false,
|
||||||
lowfuelthresh = 0.15,
|
lowfuelthresh = 0.15,
|
||||||
|
respawnafterdestroyed=false,
|
||||||
|
respawndelay = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Item of the warehouse stock table.
|
--- Item of the warehouse stock table.
|
||||||
@ -1634,11 +1638,13 @@ WAREHOUSE = {
|
|||||||
-- @field #string UNITTYPE Typename of the DCS unit, e.g. "A-10C".
|
-- @field #string UNITTYPE Typename of the DCS unit, e.g. "A-10C".
|
||||||
-- @field #string ATTRIBUTE Generalized attribute @{#WAREHOUSE.Attribute}.
|
-- @field #string ATTRIBUTE Generalized attribute @{#WAREHOUSE.Attribute}.
|
||||||
-- @field #string CATEGORY Asset category of type DCS#Group.Category, i.e. GROUND, AIRPLANE, HELICOPTER, SHIP, TRAIN.
|
-- @field #string CATEGORY Asset category of type DCS#Group.Category, i.e. GROUND, AIRPLANE, HELICOPTER, SHIP, TRAIN.
|
||||||
|
-- @field #string ASSIGNMENT Assignment of asset when it was added.
|
||||||
WAREHOUSE.Descriptor = {
|
WAREHOUSE.Descriptor = {
|
||||||
GROUPNAME="templatename",
|
GROUPNAME="templatename",
|
||||||
UNITTYPE="unittype",
|
UNITTYPE="unittype",
|
||||||
ATTRIBUTE="attribute",
|
ATTRIBUTE="attribute",
|
||||||
CATEGORY="category",
|
CATEGORY="category",
|
||||||
|
ASSIGNMENT="assignment",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Generalized asset attributes. Can be used to request assets with certain general characteristics. See [DCS attributes](https://wiki.hoggitworld.com/view/DCS_enum_attributes) on hoggit.
|
--- Generalized asset attributes. Can be used to request assets with certain general characteristics. See [DCS attributes](https://wiki.hoggitworld.com/view/DCS_enum_attributes) on hoggit.
|
||||||
@ -1743,7 +1749,7 @@ _WAREHOUSEDB = {
|
|||||||
|
|
||||||
--- Warehouse class version.
|
--- Warehouse class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
WAREHOUSE.version="0.9.2"
|
WAREHOUSE.version="0.9.5"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO: Warehouse todo list.
|
-- TODO: Warehouse todo list.
|
||||||
@ -1906,6 +1912,7 @@ function WAREHOUSE:New(warehouse, alias)
|
|||||||
self:AddTransition("*", "AirbaseRecaptured", "*") -- Airbase was re-captured from other coalition.
|
self:AddTransition("*", "AirbaseRecaptured", "*") -- Airbase was re-captured from other coalition.
|
||||||
self:AddTransition("*", "AssetDead", "*") -- An asset group died.
|
self:AddTransition("*", "AssetDead", "*") -- An asset group died.
|
||||||
self:AddTransition("*", "Destroyed", "Destroyed") -- Warehouse was destroyed. All assets in stock are gone and warehouse is stopped.
|
self:AddTransition("*", "Destroyed", "Destroyed") -- Warehouse was destroyed. All assets in stock are gone and warehouse is stopped.
|
||||||
|
self:AddTransition("Destroyed", "Respawn", "Running") -- Respawn warehouse after it was destroyed.
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
--- Pseudo Functions ---
|
--- Pseudo Functions ---
|
||||||
@ -1938,6 +1945,22 @@ function WAREHOUSE:New(warehouse, alias)
|
|||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
-- @param #number delay Delay in seconds.
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Respawn".
|
||||||
|
-- @function [parent=#WAREHOUSE] Respawn
|
||||||
|
-- @param #WAREHOUSE self
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Respawn" after a delay.
|
||||||
|
-- @function [parent=#WAREHOUSE] __Respawn
|
||||||
|
-- @param #WAREHOUSE self
|
||||||
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
|
--- On after "Respawn" event user function.
|
||||||
|
-- @function [parent=#WAREHOUSE] OnAfterRespawn
|
||||||
|
-- @param #WAREHOUSE self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
|
||||||
--- Triggers the FSM event "Pause". Pauses the warehouse. Assets can still be added and requests be made. However, requests are not processed.
|
--- Triggers the FSM event "Pause". Pauses the warehouse. Assets can still be added and requests be made. However, requests are not processed.
|
||||||
-- @function [parent=#WAREHOUSE] Pause
|
-- @function [parent=#WAREHOUSE] Pause
|
||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
@ -2531,6 +2554,15 @@ function WAREHOUSE:SetSaveOnMissionEnd(path, filename)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set respawn after destroy.
|
||||||
|
-- @param #WAREHOUSE self
|
||||||
|
-- @return #WAREHOUSE self
|
||||||
|
function WAREHOUSE:SetRespawnAfterDestroyed(delay)
|
||||||
|
self.respawnafterdestroyed=true
|
||||||
|
self.respawndelay=delay
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set the airbase belonging to this warehouse.
|
--- Set the airbase belonging to this warehouse.
|
||||||
-- Note that it has to be of the same coalition as the warehouse.
|
-- Note that it has to be of the same coalition as the warehouse.
|
||||||
@ -3684,7 +3716,7 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu
|
|||||||
self:_DebugMessage(string.format("Warehouse %s: Adding %d NEW assets of group %s to stock.", self.alias, n, tostring(group:GetName())), 5)
|
self:_DebugMessage(string.format("Warehouse %s: Adding %d NEW assets of group %s to stock.", self.alias, n, tostring(group:GetName())), 5)
|
||||||
|
|
||||||
-- This is a group that is not in the db yet. Add it n times.
|
-- This is a group that is not in the db yet. Add it n times.
|
||||||
local assets=self:_RegisterAsset(group, n, forceattribute, forcecargobay, forceweight, loadradius, liveries, skill)
|
local assets=self:_RegisterAsset(group, n, forceattribute, forcecargobay, forceweight, loadradius, liveries, skill, assignment)
|
||||||
|
|
||||||
-- Add created assets to stock of this warehouse.
|
-- Add created assets to stock of this warehouse.
|
||||||
for _,asset in pairs(assets) do
|
for _,asset in pairs(assets) do
|
||||||
@ -3720,8 +3752,9 @@ end
|
|||||||
-- @param #number loadradius Radius in meters when cargo is loaded into the carrier.
|
-- @param #number loadradius Radius in meters when cargo is loaded into the carrier.
|
||||||
-- @param #table liveries Table of liveries.
|
-- @param #table liveries Table of liveries.
|
||||||
-- @param DCS#AI.Skill skill Skill of AI.
|
-- @param DCS#AI.Skill skill Skill of AI.
|
||||||
|
-- @param #string assignment Assignment attached to the asset item.
|
||||||
-- @return #table A table containing all registered assets.
|
-- @return #table A table containing all registered assets.
|
||||||
function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay, forceweight, loadradius, liveries, skill)
|
function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay, forceweight, loadradius, liveries, skill, assignment)
|
||||||
self:F({groupname=group:GetName(), ngroups=ngroups, forceattribute=forceattribute, forcecargobay=forcecargobay, forceweight=forceweight})
|
self:F({groupname=group:GetName(), ngroups=ngroups, forceattribute=forceattribute, forcecargobay=forcecargobay, forceweight=forceweight})
|
||||||
|
|
||||||
-- Set default.
|
-- Set default.
|
||||||
@ -3823,6 +3856,7 @@ function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay,
|
|||||||
asset.livery=liveries[math.random(#liveries)]
|
asset.livery=liveries[math.random(#liveries)]
|
||||||
end
|
end
|
||||||
asset.skill=skill
|
asset.skill=skill
|
||||||
|
asset.assignment=assignment
|
||||||
|
|
||||||
if i==1 then
|
if i==1 then
|
||||||
self:_AssetItemInfo(asset)
|
self:_AssetItemInfo(asset)
|
||||||
@ -3937,8 +3971,15 @@ function WAREHOUSE:onbeforeAddRequest(From, Event, To, warehouse, AssetDescripto
|
|||||||
okay=false
|
okay=false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif AssetDescriptor==WAREHOUSE.Descriptor.ASSIGNMENT then
|
||||||
|
|
||||||
|
if type(AssetDescriptorValue)~="string" then
|
||||||
|
self:_ErrorMessage("ERROR: Invalid request. Asset assignment type must be passed as a string!", 5)
|
||||||
|
okay=false
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
self:_ErrorMessage("ERROR: Invalid request. Asset descriptor is not ATTRIBUTE, CATEGORY, GROUPNAME or UNITTYPE!", 5)
|
self:_ErrorMessage("ERROR: Invalid request. Asset descriptor is not ATTRIBUTE, CATEGORY, GROUPNAME, UNITTYPE or ASSIGNMENT!", 5)
|
||||||
okay=false
|
okay=false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3949,7 +3990,7 @@ function WAREHOUSE:onbeforeAddRequest(From, Event, To, warehouse, AssetDescripto
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Warehouse is destroyed?
|
-- Warehouse is destroyed?
|
||||||
if self:IsDestroyed() then
|
if self:IsDestroyed() and not self.respawnafterdestroyed then
|
||||||
self:_ErrorMessage("ERROR: Invalid request. Warehouse is destroyed!", 0)
|
self:_ErrorMessage("ERROR: Invalid request. Warehouse is destroyed!", 0)
|
||||||
okay=false
|
okay=false
|
||||||
end
|
end
|
||||||
@ -4816,6 +4857,21 @@ function WAREHOUSE:onbeforeChangeCountry(From, Event, To, Country)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Respawn warehouse.
|
||||||
|
-- @param #WAREHOUSE self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
function WAREHOUSE:onafterRespawn(From, Event, To)
|
||||||
|
|
||||||
|
-- Info message.
|
||||||
|
local text=string.format("Respawning warehouse %s.", self.alias)
|
||||||
|
self:_InfoMessage(text)
|
||||||
|
|
||||||
|
-- Respawn warehouse.
|
||||||
|
self.warehouse:ReSpawn()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- On after "ChangeCountry" event. Warehouse is respawned with the specified country. All queued requests are deleted and the owned airbase is reset if the coalition is changed by changing the
|
--- On after "ChangeCountry" event. Warehouse is respawned with the specified country. All queued requests are deleted and the owned airbase is reset if the coalition is changed by changing the
|
||||||
-- country.
|
-- country.
|
||||||
@ -4952,22 +5008,34 @@ end
|
|||||||
function WAREHOUSE:onafterDestroyed(From, Event, To)
|
function WAREHOUSE:onafterDestroyed(From, Event, To)
|
||||||
|
|
||||||
-- Message.
|
-- Message.
|
||||||
local text=string.format("Warehouse %s was destroyed! Assets lost %d.", self.alias, #self.stock)
|
local text=string.format("Warehouse %s was destroyed! Assets lost %d. Respawn=%s", self.alias, #self.stock, tostring(self.respawnafterdestroyed))
|
||||||
self:_InfoMessage(text)
|
self:_InfoMessage(text)
|
||||||
|
|
||||||
-- Remove all table entries from waiting queue and stock.
|
if self.respawnafterdestroyed then
|
||||||
for k,_ in pairs(self.queue) do
|
|
||||||
self.queue[k]=nil
|
|
||||||
end
|
|
||||||
for k,_ in pairs(self.stock) do
|
|
||||||
self.stock[k]=nil
|
|
||||||
end
|
|
||||||
|
|
||||||
--self.queue=nil
|
if self.respawndelay then
|
||||||
--self.queue={}
|
self:Pause()
|
||||||
|
self:__Respawn(self.respawndelay)
|
||||||
|
else
|
||||||
|
self:Respawn()
|
||||||
|
end
|
||||||
|
|
||||||
--self.stock=nil
|
else
|
||||||
--self.stock={}
|
|
||||||
|
-- Remove all table entries from waiting queue and stock.
|
||||||
|
for k,_ in pairs(self.queue) do
|
||||||
|
self.queue[k]=nil
|
||||||
|
end
|
||||||
|
for k,_ in pairs(self.stock) do
|
||||||
|
self.stock[k]=nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--self.queue=nil
|
||||||
|
--self.queue={}
|
||||||
|
|
||||||
|
--self.stock=nil
|
||||||
|
--self.stock={}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -6332,7 +6400,7 @@ function WAREHOUSE:_CheckRequestConsistancy(queue)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Is receiving warehouse destroyed?
|
-- Is receiving warehouse destroyed?
|
||||||
if request.warehouse:IsDestroyed() then
|
if request.warehouse:IsDestroyed() and not self.respawnafterdestroyed then
|
||||||
self:E(self.wid..string.format("ERROR: INVALID request. Requesting warehouse is destroyed!"))
|
self:E(self.wid..string.format("ERROR: INVALID request. Requesting warehouse is destroyed!"))
|
||||||
valid=false
|
valid=false
|
||||||
end
|
end
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
-- * Advanced F10 radio menu including carrier info, weather, radio frequencies, TACAN/ICLS channels, player LSO grades, marking of zones etc.
|
-- * Advanced F10 radio menu including carrier info, weather, radio frequencies, TACAN/ICLS channels, player LSO grades, marking of zones etc.
|
||||||
-- * Recovery tanker and refueling option via integration of @{Ops.RecoveryTanker} class.
|
-- * Recovery tanker and refueling option via integration of @{Ops.RecoveryTanker} class.
|
||||||
-- * Rescue helicopter option via @{Ops.RescueHelo} class.
|
-- * Rescue helicopter option via @{Ops.RescueHelo} class.
|
||||||
-- * Combine multiple human players to sections (WIP).
|
-- * Combine multiple human players to sections.
|
||||||
-- * Many parameters customizable by convenient user API functions.
|
-- * Many parameters customizable by convenient user API functions.
|
||||||
-- * Multiple carrier support due to object oriented approach.
|
-- * Multiple carrier support due to object oriented approach.
|
||||||
-- * Unlimited number of players.
|
-- * Unlimited number of players.
|
||||||
@ -32,7 +32,7 @@
|
|||||||
-- **Supported Aircraft:**
|
-- **Supported Aircraft:**
|
||||||
--
|
--
|
||||||
-- * [F/A-18C Hornet Lot 20](https://forums.eagle.ru/forumdisplay.php?f=557) (Player & AI)
|
-- * [F/A-18C Hornet Lot 20](https://forums.eagle.ru/forumdisplay.php?f=557) (Player & AI)
|
||||||
-- * [F-14B Tomcat](https://forums.eagle.ru/forumdisplay.php?f=395) (Player & AI) [**WIP**]
|
-- * [F-14B Tomcat](https://forums.eagle.ru/forumdisplay.php?f=395) (Player & AI)
|
||||||
-- * [A-4E Skyhawk Community Mod](https://forums.eagle.ru/showthread.php?t=224989) (Player & AI)
|
-- * [A-4E Skyhawk Community Mod](https://forums.eagle.ru/showthread.php?t=224989) (Player & AI)
|
||||||
-- * [AV-8B N/A Harrier](https://forums.eagle.ru/forumdisplay.php?f=555) (Player & AI) [**WIP**]
|
-- * [AV-8B N/A Harrier](https://forums.eagle.ru/forumdisplay.php?f=555) (Player & AI) [**WIP**]
|
||||||
-- * F/A-18C Hornet (AI)
|
-- * F/A-18C Hornet (AI)
|
||||||
@ -46,10 +46,8 @@
|
|||||||
-- the no other fixed wing aircraft (human or AI controlled) are supposed to land on the Tarawa. Currently only Case I is supported. Case II/III take slightly steps from the CVN carrier.
|
-- the no other fixed wing aircraft (human or AI controlled) are supposed to land on the Tarawa. Currently only Case I is supported. Case II/III take slightly steps from the CVN carrier.
|
||||||
-- However, the two Case II/III pattern are very similar so this is not a big drawback.
|
-- However, the two Case II/III pattern are very similar so this is not a big drawback.
|
||||||
--
|
--
|
||||||
-- Heatblur's mighty F-14B Tomcat has just been added (March 13th 2019). Beware that this is currently WIP - both the module and the AIRBOSS implementation.
|
-- Heatblur's mighty F-14B Tomcat has been added (March 13th 2019) as well.
|
||||||
--
|
--
|
||||||
-- **PLEASE NOTE** that his class is work in progress. Many/most things work already very nicely but there a lot of cases I did not run into yet.
|
|
||||||
-- Therefore, your *constructive* feedback is both necessary and appreciated!
|
|
||||||
--
|
--
|
||||||
-- ## Discussion
|
-- ## Discussion
|
||||||
--
|
--
|
||||||
@ -174,7 +172,6 @@
|
|||||||
-- @field #number NmaxStack Number of max flights per stack. Default 2.
|
-- @field #number NmaxStack Number of max flights per stack. Default 2.
|
||||||
-- @field #boolean handleai If true (default), handle AI aircraft.
|
-- @field #boolean handleai If true (default), handle AI aircraft.
|
||||||
-- @field Ops.RecoveryTanker#RECOVERYTANKER tanker Recovery tanker flying overhead of carrier.
|
-- @field Ops.RecoveryTanker#RECOVERYTANKER tanker Recovery tanker flying overhead of carrier.
|
||||||
-- @field Functional.Warehouse#WAREHOUSE warehouse Warehouse object of the carrier.
|
|
||||||
-- @field DCS#Vec3 Corientation Carrier orientation in space.
|
-- @field DCS#Vec3 Corientation Carrier orientation in space.
|
||||||
-- @field DCS#Vec3 Corientlast Last known carrier orientation.
|
-- @field DCS#Vec3 Corientlast Last known carrier orientation.
|
||||||
-- @field Core.Point#COORDINATE Cposition Carrier position.
|
-- @field Core.Point#COORDINATE Cposition Carrier position.
|
||||||
@ -1182,7 +1179,6 @@ AIRBOSS = {
|
|||||||
NmaxStack = nil,
|
NmaxStack = nil,
|
||||||
handleai = nil,
|
handleai = nil,
|
||||||
tanker = nil,
|
tanker = nil,
|
||||||
warehouse = nil,
|
|
||||||
Corientation = nil,
|
Corientation = nil,
|
||||||
Corientlast = nil,
|
Corientlast = nil,
|
||||||
Cposition = nil,
|
Cposition = nil,
|
||||||
@ -1685,7 +1681,7 @@ AIRBOSS.MenuF10Root=nil
|
|||||||
|
|
||||||
--- Airboss class version.
|
--- Airboss class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AIRBOSS.version="1.0.2"
|
AIRBOSS.version="1.0.3"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -1803,6 +1799,15 @@ function AIRBOSS:New(carriername, alias)
|
|||||||
-- Init player scores table.
|
-- Init player scores table.
|
||||||
self.playerscores={}
|
self.playerscores={}
|
||||||
|
|
||||||
|
-- Initialize ME waypoints.
|
||||||
|
self:_InitWaypoints()
|
||||||
|
|
||||||
|
-- Current waypoint.
|
||||||
|
self.currentwp=1
|
||||||
|
|
||||||
|
-- Patrol route.
|
||||||
|
self:_PatrolRoute()
|
||||||
|
|
||||||
-------------
|
-------------
|
||||||
--- Defaults:
|
--- Defaults:
|
||||||
-------------
|
-------------
|
||||||
@ -2432,6 +2437,19 @@ function AIRBOSS:SetExcludeAI(setgroup)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a group to the exclude set. If no set exists, it is created.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param Wrapper.Group#GROUP group The group to be excluded.
|
||||||
|
-- @return #AIRBOSS self
|
||||||
|
function AIRBOSS:AddExcludeAI(group)
|
||||||
|
|
||||||
|
self.excludesetAI=self.excludesetAI or SET_GROUP:New()
|
||||||
|
|
||||||
|
self.excludesetAI:AddGroup(group)
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Close currently running recovery window and stop recovery ops. Recovery window is deleted.
|
--- Close currently running recovery window and stop recovery ops. Recovery window is deleted.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #number delay (Optional) Delay in seconds before the window is deleted.
|
-- @param #number delay (Optional) Delay in seconds before the window is deleted.
|
||||||
@ -3044,15 +3062,6 @@ function AIRBOSS:SetRecoveryTanker(recoverytanker)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Define warehouse associated with the carrier.
|
|
||||||
-- @param #AIRBOSS self
|
|
||||||
-- @param Functional.Warehouse#WAREHOUSE warehouse Warehouse object of the carrier.
|
|
||||||
-- @return #AIRBOSS self
|
|
||||||
function AIRBOSS:SetWarehouse(warehouse)
|
|
||||||
self.warehouse=warehouse
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Set default player skill. New players will be initialized with this skill.
|
--- Set default player skill. New players will be initialized with this skill.
|
||||||
--
|
--
|
||||||
-- * "Flight Student" = @{#AIRBOSS.Difficulty.Easy}
|
-- * "Flight Student" = @{#AIRBOSS.Difficulty.Easy}
|
||||||
@ -3202,9 +3211,6 @@ function AIRBOSS:onafterStart(From, Event, To)
|
|||||||
self.Corientlast=self.Corientation
|
self.Corientlast=self.Corientation
|
||||||
self.Tpupdate=timer.getTime()
|
self.Tpupdate=timer.getTime()
|
||||||
|
|
||||||
-- Init patrol route of carrier.
|
|
||||||
self:_PatrolRoute(1)
|
|
||||||
|
|
||||||
-- Check if no recovery window is set. DISABLED!
|
-- Check if no recovery window is set. DISABLED!
|
||||||
if #self.recoverytimes==0 and false then
|
if #self.recoverytimes==0 and false then
|
||||||
|
|
||||||
@ -3232,9 +3238,6 @@ function AIRBOSS:onafterStart(From, Event, To)
|
|||||||
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._PlayerLeft)
|
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._PlayerLeft)
|
||||||
self:HandleEvent(EVENTS.MissionEnd)
|
self:HandleEvent(EVENTS.MissionEnd)
|
||||||
|
|
||||||
-- DCS event handler.
|
|
||||||
--world.addEventHandler(self)
|
|
||||||
|
|
||||||
-- Start status check in 1 second.
|
-- Start status check in 1 second.
|
||||||
self:__Status(1)
|
self:__Status(1)
|
||||||
end
|
end
|
||||||
@ -3617,15 +3620,31 @@ function AIRBOSS:_CheckRecoveryTimes()
|
|||||||
|
|
||||||
if self:IsRecovering() and not recovery.OVER then
|
if self:IsRecovering() and not recovery.OVER then
|
||||||
|
|
||||||
-- Set carrier to idle.
|
-- Get number of airborne aircraft units(!) currently in pattern.
|
||||||
self:RecoveryStop()
|
local _,npattern=self:_GetQueueInfo(self.Qpattern)
|
||||||
state="closing now"
|
|
||||||
|
|
||||||
-- Closed.
|
if npattern>0 then
|
||||||
recovery.OPEN=false
|
|
||||||
|
|
||||||
-- Window just closed.
|
-- Extend recovery time. 5 min per flight.
|
||||||
recovery.OVER=true
|
local extmin=5*npattern
|
||||||
|
recovery.STOP=recovery.STOP+extmin*60
|
||||||
|
|
||||||
|
local text=string.format("We still got flights in the pattern.\nRecovery time prolonged by %d minutes.\nNow get your act together and no more bolters!", extmin)
|
||||||
|
self:MessageToPattern(text, "AIRBOSS", "99", 10, false, nil)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Set carrier to idle.
|
||||||
|
self:RecoveryStop()
|
||||||
|
state="closing now"
|
||||||
|
|
||||||
|
-- Closed.
|
||||||
|
recovery.OPEN=false
|
||||||
|
|
||||||
|
-- Window just closed.
|
||||||
|
recovery.OVER=true
|
||||||
|
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Carrier is already idle.
|
-- Carrier is already idle.
|
||||||
@ -3690,9 +3709,10 @@ function AIRBOSS:_CheckRecoveryTimes()
|
|||||||
--Debug info
|
--Debug info
|
||||||
self:T(self.lid..string.format("Heading=%03d°, Wind=%03d° %.1f kts, Delta=%03d° ==> U-turn=%s", hdg, wind,UTILS.MpsToKnots(vwind), delta, tostring(uturn)))
|
self:T(self.lid..string.format("Heading=%03d°, Wind=%03d° %.1f kts, Delta=%03d° ==> U-turn=%s", hdg, wind,UTILS.MpsToKnots(vwind), delta, tostring(uturn)))
|
||||||
|
|
||||||
|
-- Time into the wind 1 day or if longer recovery time + the 5 min early.
|
||||||
|
local t=math.max(nextwindow.STOP-nextwindow.START+300, 60*60*24)
|
||||||
|
|
||||||
-- Time into the wind + the 5 min early.
|
-- Recovery wind on deck in knots.
|
||||||
local t=nextwindow.STOP-nextwindow.START+300
|
|
||||||
local v=UTILS.KnotsToMps(nextwindow.SPEED)
|
local v=UTILS.KnotsToMps(nextwindow.SPEED)
|
||||||
|
|
||||||
-- Check that we do not go above max possible speed.
|
-- Check that we do not go above max possible speed.
|
||||||
@ -13206,6 +13226,42 @@ function AIRBOSS:_GetNextWaypoint()
|
|||||||
return nextwp,Nextwp
|
return nextwp,Nextwp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Initialize Mission Editor waypoints.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @return #AIRBOSS self
|
||||||
|
function AIRBOSS:_InitWaypoints()
|
||||||
|
|
||||||
|
-- Waypoints of group as defined in the ME.
|
||||||
|
local Waypoints=self.carrier:GetGroup():GetTemplateRoutePoints()
|
||||||
|
|
||||||
|
-- Init array.
|
||||||
|
self.waypoints={}
|
||||||
|
|
||||||
|
-- Set waypoint table.
|
||||||
|
for i,point in ipairs(Waypoints) do
|
||||||
|
|
||||||
|
-- Coordinate of the waypoint
|
||||||
|
local coord=COORDINATE:New(point.x, point.alt, point.y)
|
||||||
|
|
||||||
|
-- Set velocity of the coordinate.
|
||||||
|
coord:SetVelocity(point.speed)
|
||||||
|
|
||||||
|
-- Add to table.
|
||||||
|
table.insert(self.waypoints, coord)
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
if self.Debug then
|
||||||
|
coord:MarkToAll(string.format("Carrier Waypoint %d, Speed=%.1f knots", i, UTILS.MpsToKnots(point.speed)))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
--- Patrol carrier.
|
--- Patrol carrier.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #number n Current waypoint.
|
-- @param #number n Current waypoint.
|
||||||
@ -13259,6 +13315,58 @@ function AIRBOSS:_PatrolRoute(n)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
--- Patrol carrier.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #number n Next waypoint number.
|
||||||
|
-- @return #AIRBOSS self
|
||||||
|
function AIRBOSS:_PatrolRoute(n)
|
||||||
|
|
||||||
|
-- Get next waypoint coordinate and number.
|
||||||
|
local nextWP, N=self:_GetNextWaypoint()
|
||||||
|
|
||||||
|
-- Default resume is to next waypoint.
|
||||||
|
n=n or N
|
||||||
|
|
||||||
|
-- Get carrier group.
|
||||||
|
local CarrierGroup=self.carrier:GetGroup()
|
||||||
|
|
||||||
|
-- Waypoints table.
|
||||||
|
local Waypoints={}
|
||||||
|
|
||||||
|
-- Create a waypoint from the current coordinate.
|
||||||
|
local wp=self:GetCoordinate():WaypointGround(CarrierGroup:GetVelocityKMH())
|
||||||
|
|
||||||
|
-- Add current position as first waypoint.
|
||||||
|
table.insert(Waypoints, wp)
|
||||||
|
|
||||||
|
-- Loop over waypoints.
|
||||||
|
for i=n,#self.waypoints do
|
||||||
|
local coord=self.waypoints[i] --Core.Point#COORDINATE
|
||||||
|
|
||||||
|
-- Create a waypoint from the coordinate.
|
||||||
|
local wp=coord:WaypointGround(UTILS.MpsToKmph(coord.Velocity))
|
||||||
|
|
||||||
|
-- Passing waypoint taskfunction
|
||||||
|
local TaskPassingWP=CarrierGroup:TaskFunction("AIRBOSS._PassingWaypoint", self, i, #self.waypoints)
|
||||||
|
|
||||||
|
-- Call task function when carrier arrives at waypoint.
|
||||||
|
CarrierGroup:SetTaskWaypoint(wp, TaskPassingWP)
|
||||||
|
|
||||||
|
-- Add waypoint to table.
|
||||||
|
table.insert(Waypoints, wp)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Route carrier group.
|
||||||
|
CarrierGroup:Route(Waypoints)
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Estimated the carrier position at some point in the future given the current waypoints and speeds.
|
--- Estimated the carrier position at some point in the future given the current waypoints and speeds.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @return DCS#time ETA abs. time in seconds.
|
-- @return DCS#time ETA abs. time in seconds.
|
||||||
@ -13484,7 +13592,7 @@ function AIRBOSS._PassingWaypoint(group, airboss, i, final)
|
|||||||
|
|
||||||
-- If final waypoint reached, do route all over again.
|
-- If final waypoint reached, do route all over again.
|
||||||
if i==final and final>1 and airboss.adinfinitum then
|
if i==final and final>1 and airboss.adinfinitum then
|
||||||
airboss:_PatrolRoute(i)
|
airboss:_PatrolRoute()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -553,14 +553,14 @@ function AIRBASE:GetParkingSpotsTable(termtype)
|
|||||||
local spots={}
|
local spots={}
|
||||||
for _,_spot in pairs(parkingdata) do
|
for _,_spot in pairs(parkingdata) do
|
||||||
if AIRBASE._CheckTerminalType(_spot.Term_Type, termtype) then
|
if AIRBASE._CheckTerminalType(_spot.Term_Type, termtype) then
|
||||||
self:I({_spot=_spot})
|
self:T2({_spot=_spot})
|
||||||
local _free=_isfree(_spot)
|
local _free=_isfree(_spot)
|
||||||
local _coord=COORDINATE:NewFromVec3(_spot.vTerminalPos)
|
local _coord=COORDINATE:NewFromVec3(_spot.vTerminalPos)
|
||||||
table.insert(spots, {Coordinate=_coord, TerminalID=_spot.Term_Index, TerminalType=_spot.Term_Type, TOAC=_spot.TO_AC, Free=_free, TerminalID0=_spot.Term_Index_0, DistToRwy=_spot.fDistToRW})
|
table.insert(spots, {Coordinate=_coord, TerminalID=_spot.Term_Index, TerminalType=_spot.Term_Type, TOAC=_spot.TO_AC, Free=_free, TerminalID0=_spot.Term_Index_0, DistToRwy=_spot.fDistToRW})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:I({ spots = spots } )
|
self:T2({ spots = spots } )
|
||||||
|
|
||||||
return spots
|
return spots
|
||||||
end
|
end
|
||||||
@ -711,7 +711,7 @@ function AIRBASE:FindFreeParkingSpotForAircraft(group, terminaltype, scanradius,
|
|||||||
local _spot=parkingspot.Coordinate -- Core.Point#COORDINATE
|
local _spot=parkingspot.Coordinate -- Core.Point#COORDINATE
|
||||||
local _termid=parkingspot.TerminalID
|
local _termid=parkingspot.TerminalID
|
||||||
|
|
||||||
self:I({_termid=_termid})
|
self:T2({_termid=_termid})
|
||||||
|
|
||||||
if AIRBASE._CheckTerminalType(parkingspot.TerminalType, terminaltype) then
|
if AIRBASE._CheckTerminalType(parkingspot.TerminalType, terminaltype) then
|
||||||
|
|
||||||
|
|||||||
@ -1388,7 +1388,7 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType )
|
|||||||
DCSTask = { id = 'FireAtPoint',
|
DCSTask = { id = 'FireAtPoint',
|
||||||
params = {
|
params = {
|
||||||
point = Vec2,
|
point = Vec2,
|
||||||
radius = Radius,
|
zoneRadius = Radius,
|
||||||
expendQty = 100, -- dummy value
|
expendQty = 100, -- dummy value
|
||||||
expendQtyEnabled = false,
|
expendQtyEnabled = false,
|
||||||
}
|
}
|
||||||
@ -3165,7 +3165,8 @@ function CONTROLLABLE:OptionAlarmStateAuto()
|
|||||||
if self:IsGround() then
|
if self:IsGround() then
|
||||||
Controller:setOption(AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.AUTO)
|
Controller:setOption(AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.AUTO)
|
||||||
elseif self:IsShip() then
|
elseif self:IsShip() then
|
||||||
Controller:setOption(AI.Option.Naval.id.ALARM_STATE, AI.Option.Naval.val.ALARM_STATE.AUTO)
|
--Controller:setOption(AI.Option.Naval.id.ALARM_STATE, AI.Option.Naval.val.ALARM_STATE.AUTO)
|
||||||
|
Controller:setOption(9, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -3189,6 +3190,7 @@ function CONTROLLABLE:OptionAlarmStateGreen()
|
|||||||
elseif self:IsShip() then
|
elseif self:IsShip() then
|
||||||
-- AI.Option.Naval.id.ALARM_STATE does not seem to exist!
|
-- AI.Option.Naval.id.ALARM_STATE does not seem to exist!
|
||||||
--Controller:setOption( AI.Option.Naval.id.ALARM_STATE, AI.Option.Naval.val.ALARM_STATE.GREEN )
|
--Controller:setOption( AI.Option.Naval.id.ALARM_STATE, AI.Option.Naval.val.ALARM_STATE.GREEN )
|
||||||
|
Controller:setOption(9, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -3210,7 +3212,8 @@ function CONTROLLABLE:OptionAlarmStateRed()
|
|||||||
if self:IsGround() then
|
if self:IsGround() then
|
||||||
Controller:setOption(AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.RED)
|
Controller:setOption(AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.RED)
|
||||||
elseif self:IsShip() then
|
elseif self:IsShip() then
|
||||||
Controller:setOption(AI.Option.Naval.id.ALARM_STATE, AI.Option.Naval.val.ALARM_STATE.RED)
|
--Controller:setOption(AI.Option.Naval.id.ALARM_STATE, AI.Option.Naval.val.ALARM_STATE.RED)
|
||||||
|
Controller:setOption(9, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|||||||
@ -1184,6 +1184,24 @@ function POSITIONABLE:LaseUnit( Target, LaserCode, Duration ) --R2.1
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Start Lasing a COORDINATE.
|
||||||
|
-- @param #POSITIONABLE self
|
||||||
|
-- @param Core.Point#COORDIUNATE Coordinate The coordinate where the lase is pointing at.
|
||||||
|
-- @param #number LaserCode Laser code or random number in [1000, 9999].
|
||||||
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
|
-- @return Core.Spot#SPOT
|
||||||
|
function POSITIONABLE:LaseCoordinate(Coordinate, LaserCode, Duration)
|
||||||
|
self:F2()
|
||||||
|
|
||||||
|
LaserCode = LaserCode or math.random(1000, 9999)
|
||||||
|
|
||||||
|
self.Spot = SPOT:New(self) -- Core.Spot#SPOT
|
||||||
|
self.Spot:LaseOnCoordinate(Coordinate, LaserCode, Duration)
|
||||||
|
self.LaserCode = LaserCode
|
||||||
|
|
||||||
|
return self.Spot
|
||||||
|
end
|
||||||
|
|
||||||
--- Stop Lasing a POSITIONABLE
|
--- Stop Lasing a POSITIONABLE
|
||||||
-- @param #POSITIONABLE self
|
-- @param #POSITIONABLE self
|
||||||
-- @return #POSITIONABLE
|
-- @return #POSITIONABLE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user