mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'FF/Ops' into FF/OpsDev
This commit is contained in:
@@ -312,10 +312,16 @@
|
||||
--
|
||||
-- atis=ATIS:New("Batumi", 305, radio.modulation.AM)
|
||||
-- atis:SetSRS("D:\\DCS\\_SRS\\", "male", "en-US")
|
||||
-- atis:Start()
|
||||
-- atis:Start()
|
||||
--
|
||||
-- This uses a male voice with US accent. It requires SRS to be installed in the `D:\DCS\_SRS\` directory. Note that backslashes need to be escaped or simply use slashes (as in linux).
|
||||
--
|
||||
-- ### SRS can use multiple frequencies:
|
||||
--
|
||||
-- atis=ATIS:New("Batumi", {305,103.85}, {radio.modulation.AM,radio.modulation.FM})
|
||||
-- atis:SetSRS("D:\\DCS\\_SRS\\", "male", "en-US")
|
||||
-- atis:Start()
|
||||
--
|
||||
-- ### SRS Localization
|
||||
--
|
||||
-- You can localize the SRS output, all you need is to provide a table of translations and set the `locale` of your instance. You need to provide the translations in your script **before you instantiate your ATIS**.
|
||||
@@ -884,13 +890,14 @@ _ATIS = {}
|
||||
|
||||
--- ATIS class version.
|
||||
-- @field #string version
|
||||
ATIS.version = "0.10.3"
|
||||
ATIS.version = "0.10.4"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Correct fog for elevation.
|
||||
-- DONE: Option to add multiple frequencies for SRS
|
||||
-- DONE: Zulu time --> Zulu in output.
|
||||
-- DONE: Fix for AB not having a runway - Helopost like Naqoura
|
||||
-- DONE: Add new Normandy airfields.
|
||||
@@ -899,7 +906,7 @@ ATIS.version = "0.10.3"
|
||||
-- DONE: Visibility reported twice over SRS
|
||||
-- DONE: Add text report for output.
|
||||
-- DONE: Add stop FMS functions.
|
||||
-- NOGO: Use local time. Not realisitc!
|
||||
-- NOGO: Use local time. Not realistic!
|
||||
-- DONE: Dew point. Approx. done.
|
||||
-- DONE: Metric units.
|
||||
-- DONE: Set UTC correction.
|
||||
@@ -915,8 +922,8 @@ ATIS.version = "0.10.3"
|
||||
--- Create a new ATIS class object for a specific airbase.
|
||||
-- @param #ATIS self
|
||||
-- @param #string AirbaseName Name of the airbase.
|
||||
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz.
|
||||
-- @param #number Modulation Radio modulation: 0=AM, 1=FM. Default 0=AM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators.
|
||||
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz. When using **SRS** this can be passed as a table of multiple frequencies.
|
||||
-- @param #number Modulation Radio modulation: 0=AM, 1=FM. Default 0=AM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators. When using **SRS** this can be passed as a table of multiple modulations.
|
||||
-- @return #ATIS self
|
||||
function ATIS:New(AirbaseName, Frequency, Modulation)
|
||||
|
||||
@@ -1594,8 +1601,16 @@ function ATIS:onafterStart( From, Event, To )
|
||||
end
|
||||
|
||||
-- Info.
|
||||
self:I( self.lid .. string.format( "Starting ATIS v%s for airbase %s on %.3f MHz Modulation=%d", ATIS.version, self.airbasename, self.frequency, self.modulation ) )
|
||||
|
||||
if type(self.frequency) == "table" then
|
||||
local frequency = table.concat(self.frequency,"/")
|
||||
local modulation = self.modulation
|
||||
if type(self.modulation) == "table" then
|
||||
modulation = table.concat(self.modulation,"/")
|
||||
end
|
||||
self:I( self.lid .. string.format( "Starting ATIS v%s for airbase %s on %s MHz Modulation=%s", ATIS.version, self.airbasename, frequency, modulation ) )
|
||||
else
|
||||
self:I( self.lid .. string.format( "Starting ATIS v%s for airbase %s on %.3f MHz Modulation=%d", ATIS.version, self.airbasename, self.frequency, self.modulation ) )
|
||||
end
|
||||
-- Start radio queue.
|
||||
if not self.useSRS then
|
||||
self.radioqueue = RADIOQUEUE:New( self.frequency, self.modulation, string.format( "ATIS %s", self.airbasename ) )
|
||||
@@ -1653,7 +1668,17 @@ function ATIS:onafterStatus( From, Event, To )
|
||||
end
|
||||
|
||||
-- Info text.
|
||||
local text = string.format( "State %s: Freq=%.3f MHz %s", fsmstate, self.frequency, UTILS.GetModulationName( self.modulation ) )
|
||||
local text = ""
|
||||
if type(self.frequency) == "table" then
|
||||
local frequency = table.concat(self.frequency,"/")
|
||||
local modulation = self.modulation
|
||||
if type(self.modulation) == "table" then
|
||||
modulation = table.concat(self.modulation,"/")
|
||||
end
|
||||
text = string.format( "State %s: Freq=%s MHz %s", fsmstate, frequency, modulation )
|
||||
else
|
||||
text = string.format( "State %s: Freq=%.3f MHz %s", fsmstate, self.frequency, UTILS.GetModulationName( self.modulation ) )
|
||||
end
|
||||
if self.useSRS then
|
||||
text = text .. string.format( ", SRS path=%s (%s), gender=%s, culture=%s, voice=%s", tostring( self.msrs.path ), tostring( self.msrs.port ), tostring( self.msrs.gender ), tostring( self.msrs.culture ), tostring( self.msrs.voice ) )
|
||||
else
|
||||
@@ -2919,8 +2944,17 @@ function ATIS:UpdateMarker( information, runact, wind, altimeter, temperature )
|
||||
if self.markerid then
|
||||
self.airbase:GetCoordinate():RemoveMark( self.markerid )
|
||||
end
|
||||
|
||||
local text = string.format( "ATIS on %.3f %s, %s:\n", self.frequency, UTILS.GetModulationName( self.modulation ), tostring( information ) )
|
||||
local text = ""
|
||||
if type(self.frequency) == "table" then
|
||||
local frequency = table.concat(self.frequency,"/")
|
||||
local modulation = self.modulation
|
||||
if type(modulation) == "table" then
|
||||
modulation = table.concat(self.modulation,"/")
|
||||
end
|
||||
text = string.format( "ATIS on %s %s, %s:\n", tostring(frequency), tostring(modulation), tostring( information ) )
|
||||
else
|
||||
text = string.format( "ATIS on %.3f %s, %s:\n", self.frequency, UTILS.GetModulationName( self.modulation ), tostring( information ) )
|
||||
end
|
||||
text = text .. string.format( "%s\n", tostring( runact ) )
|
||||
text = text .. string.format( "%s\n", tostring( wind ) )
|
||||
text = text .. string.format( "%s\n", tostring( altimeter ) )
|
||||
|
||||
@@ -976,7 +976,8 @@ function ARMYGROUP:onafterSpawned(From, Event, To)
|
||||
-- Update route.
|
||||
if Nwp>1 and self.isMobile then
|
||||
self:T(self.lid..string.format("Got %d waypoints on spawn ==> Cruise in -1.0 sec!", Nwp))
|
||||
self:__Cruise(-1, nil, self.option.Formation)
|
||||
--self:__Cruise(-1, nil, self.option.Formation)
|
||||
self:__Cruise(-1)
|
||||
else
|
||||
self:T(self.lid.."No waypoints on spawn ==> Full Stop!")
|
||||
self:FullStop()
|
||||
@@ -1948,7 +1949,7 @@ function ARMYGROUP:onafterCruise(From, Event, To, Speed, Formation)
|
||||
self.dTwait=nil
|
||||
|
||||
-- Debug info.
|
||||
self:T(self.lid.."Cruise ==> Update route in 0.01 sec")
|
||||
self:T(self.lid..string.format("Cruise ==> Update route in 0.01 sec (speed=%s, formation=%s)", tostring(Speed), tostring(Formation)))
|
||||
|
||||
-- Update route.
|
||||
self:__UpdateRoute(-0.01, nil, nil, Speed, Formation)
|
||||
@@ -2003,7 +2004,7 @@ function ARMYGROUP:AddWaypoint(Coordinate, Speed, AfterWaypointWithID, Formation
|
||||
elseif self.optionDefault.Formation then
|
||||
Formation = self.optionDefault.Formation
|
||||
elseif self.option.Formation then
|
||||
Formation = self.option.Formation
|
||||
Formation = self.option.Formation
|
||||
else
|
||||
-- Default formation is on road.
|
||||
Formation = ENUMS.Formation.Vehicle.OnRoad
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
-- @module Ops.CTLD
|
||||
-- @image OPS_CTLD.jpg
|
||||
|
||||
-- Last Update October 2023
|
||||
-- Last Update November 2023
|
||||
|
||||
do
|
||||
|
||||
@@ -741,7 +741,7 @@ do
|
||||
--
|
||||
-- -- E.g. update unit capabilities for testing. Please stay realistic in your mission design.
|
||||
-- -- Make a Gazelle into a heavy truck, this type can load both crates and troops and eight of each type, up to 4000 kgs:
|
||||
-- my_ctld:UnitCapabilities("SA342L", true, true, 8, 8, 12, 4000)
|
||||
-- my_ctld:SetUnitCapabilities("SA342L", true, true, 8, 8, 12, 4000)
|
||||
--
|
||||
-- -- Default unit type capabilities are:
|
||||
-- ["SA342Mistral"] = {type="SA342Mistral", crates=false, troops=true, cratelimit = 0, trooplimit = 4, length = 12, cargoweightlimit = 400},
|
||||
@@ -1200,14 +1200,14 @@ CTLD.CargoZoneType = {
|
||||
-- @field #CTLD_CARGO.Enum Type Type enumerator (for moves).
|
||||
|
||||
--- Unit capabilities.
|
||||
-- @type CTLD.UnitCapabilities
|
||||
-- @type CTLD.UnitTypeCapabilities
|
||||
-- @field #string type Unit type.
|
||||
-- @field #boolean crates Can transport crate.
|
||||
-- @field #boolean troops Can transport troops.
|
||||
-- @field #number cratelimit Number of crates transportable.
|
||||
-- @field #number trooplimit Number of troop units transportable.
|
||||
-- @field #number cargoweightlimit Max loadable kgs of cargo.
|
||||
CTLD.UnitTypes = {
|
||||
CTLD.UnitTypeCapabilities = {
|
||||
["SA342Mistral"] = {type="SA342Mistral", crates=false, troops=true, cratelimit = 0, trooplimit = 4, length = 12, cargoweightlimit = 400},
|
||||
["SA342L"] = {type="SA342L", crates=false, troops=true, cratelimit = 0, trooplimit = 2, length = 12, cargoweightlimit = 400},
|
||||
["SA342M"] = {type="SA342M", crates=false, troops=true, cratelimit = 0, trooplimit = 4, length = 12, cargoweightlimit = 400},
|
||||
@@ -1228,7 +1228,7 @@ CTLD.UnitTypes = {
|
||||
|
||||
--- CTLD class version.
|
||||
-- @field #string version
|
||||
CTLD.version="1.0.41"
|
||||
CTLD.version="1.0.43"
|
||||
|
||||
--- Instantiate a new CTLD.
|
||||
-- @param #CTLD self
|
||||
@@ -1293,6 +1293,8 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
||||
self:AddTransition("*", "CratesDropped", "*") -- CTLD deploy event.
|
||||
self:AddTransition("*", "CratesBuild", "*") -- CTLD build event.
|
||||
self:AddTransition("*", "CratesRepaired", "*") -- CTLD repair event.
|
||||
self:AddTransition("*", "CratesBuildStarted", "*") -- CTLD build event.
|
||||
self:AddTransition("*", "CratesRepairStarted", "*") -- CTLD repair event.
|
||||
self:AddTransition("*", "Load", "*") -- CTLD load event.
|
||||
self:AddTransition("*", "Save", "*") -- CTLD save event.
|
||||
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
|
||||
@@ -1475,7 +1477,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
||||
-- @param #CTLD self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
--- FSM Function OnBeforeTroopsPickedUp.
|
||||
--- FSM Function OnBeforeTroopsPickedUp.
|
||||
-- @function [parent=#CTLD] OnBeforeTroopsPickedUp
|
||||
-- @param #CTLD self
|
||||
-- @param #string From State.
|
||||
@@ -1627,6 +1629,46 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
||||
-- @param Wrapper.Group#GROUP Vehicle The #GROUP object of the vehicle or FOB build.
|
||||
-- @return #CTLD self
|
||||
|
||||
--- FSM Function OnAfterCratesBuildStarted. Info event that a build has been started.
|
||||
-- @function [parent=#CTLD] OnAfterCratesBuildStarted
|
||||
-- @param #CTLD self
|
||||
-- @param #string From State.
|
||||
-- @param #string Event Trigger.
|
||||
-- @param #string To State.
|
||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||
-- @return #CTLD self
|
||||
|
||||
--- FSM Function OnAfterCratesRepairStarted. Info event that a repair has been started.
|
||||
-- @function [parent=#CTLD] OnAfterCratesRepairStarted
|
||||
-- @param #CTLD self
|
||||
-- @param #string From State.
|
||||
-- @param #string Event Trigger.
|
||||
-- @param #string To State.
|
||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||
-- @return #CTLD self
|
||||
|
||||
--- FSM Function OnBeforeCratesBuildStarted. Info event that a build has been started.
|
||||
-- @function [parent=#CTLD] OnBeforeCratesBuildStarted
|
||||
-- @param #CTLD self
|
||||
-- @param #string From State.
|
||||
-- @param #string Event Trigger.
|
||||
-- @param #string To State.
|
||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||
-- @return #CTLD self
|
||||
|
||||
--- FSM Function OnBeforeCratesRepairStarted. Info event that a repair has been started.
|
||||
-- @function [parent=#CTLD] OnBeforeCratesRepairStarted
|
||||
-- @param #CTLD self
|
||||
-- @param #string From State.
|
||||
-- @param #string Event Trigger.
|
||||
-- @param #string To State.
|
||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||
-- @return #CTLD self
|
||||
|
||||
--- FSM Function OnAfterCratesRepaired.
|
||||
-- @function [parent=#CTLD] OnAfterCratesRepaired
|
||||
-- @param #CTLD self
|
||||
@@ -1680,7 +1722,7 @@ function CTLD:_GetUnitCapabilities(Unit)
|
||||
self:T(self.lid .. " _GetUnitCapabilities")
|
||||
local _unit = Unit -- Wrapper.Unit#UNIT
|
||||
local unittype = _unit:GetTypeName()
|
||||
local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local capabilities = self.UnitTypeCapabilities[unittype] -- #CTLD.UnitTypeCapabilities
|
||||
if not capabilities or capabilities == {} then
|
||||
-- e.g. ["Ka-50"] = {type="Ka-50", crates=false, troops=false, cratelimit = 0, trooplimit = 0},
|
||||
capabilities = {}
|
||||
@@ -1871,7 +1913,7 @@ function CTLD:_PreloadCrates(Group, Unit, Cargo, NumberOfCrates)
|
||||
local unitname = unit:GetName()
|
||||
-- see if this heli can load crates
|
||||
local unittype = unit:GetTypeName()
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitTypeCapabilities
|
||||
local cancrates = capabilities.crates -- #boolean
|
||||
local cratelimit = capabilities.cratelimit -- #number
|
||||
if not cancrates then
|
||||
@@ -2124,6 +2166,7 @@ function CTLD:_RepairObjectFromCrates(Group,Unit,Crates,Build,Number,Engineering
|
||||
desttimer:Start(self.repairtime - 1)
|
||||
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,object,true,NearestGroup:GetCoordinate())
|
||||
buildtimer:Start(self.repairtime)
|
||||
self:__CratesRepairStarted(1,Group,Unit)
|
||||
else
|
||||
if not Engineering then
|
||||
self:_SendMessage("Can't repair this unit with " .. build.Name, 10, false, Group)
|
||||
@@ -2308,7 +2351,7 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack)
|
||||
end
|
||||
|
||||
-- avoid crate spam
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitTypeCapabilities
|
||||
local canloadcratesno = capabilities.cratelimit
|
||||
local loaddist = self.CrateDistance or 35
|
||||
local nearcrates, numbernearby = self:_FindCratesNearby(Group,Unit,loaddist,true)
|
||||
@@ -2601,8 +2644,8 @@ function CTLD:_LoadCratesNearby(Group, Unit)
|
||||
local unitname = unit:GetName()
|
||||
-- see if this heli can load crates
|
||||
local unittype = unit:GetTypeName()
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
--local capabilities = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitTypeCapabilities
|
||||
--local capabilities = self.UnitTypeCapabilities[unittype] -- #CTLD.UnitTypeCapabilities
|
||||
local cancrates = capabilities.crates -- #boolean
|
||||
local cratelimit = capabilities.cratelimit -- #number
|
||||
local grounded = not self:IsUnitInAir(Unit)
|
||||
@@ -2753,7 +2796,7 @@ function CTLD:_GetMaxLoadableMass(Unit)
|
||||
if not Unit then return 0 end
|
||||
local loadable = 0
|
||||
local loadedmass = self:_GetUnitCargoMass(Unit)
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitTypeCapabilities
|
||||
local maxmass = capabilities.cargoweightlimit or 2000 -- max 2 tons
|
||||
loadable = maxmass - loadedmass
|
||||
return loadable
|
||||
@@ -2778,7 +2821,7 @@ function CTLD:_ListCargo(Group, Unit)
|
||||
self:T(self.lid .. " _ListCargo")
|
||||
local unitname = Unit:GetName()
|
||||
local unittype = Unit:GetTypeName()
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitTypeCapabilities
|
||||
local trooplimit = capabilities.trooplimit -- #boolean
|
||||
local cratelimit = capabilities.cratelimit -- #number
|
||||
local loadedcargo = self.Loaded_Cargo[unitname] or {} -- #CTLD.LoadedCargo
|
||||
@@ -3226,6 +3269,7 @@ function CTLD:_BuildCrates(Group, Unit,Engineering)
|
||||
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,build,false,Group:GetCoordinate())
|
||||
buildtimer:Start(self.buildtime)
|
||||
self:_SendMessage(string.format("Build started, ready in %d seconds!",self.buildtime),15,false,Group)
|
||||
self:__CratesBuildStarted(1,Group,Unit)
|
||||
else
|
||||
self:_BuildObjectFromCrates(Group,Unit,build)
|
||||
end
|
||||
@@ -3536,13 +3580,19 @@ function CTLD:_RefreshF10Menus()
|
||||
if _group then
|
||||
-- get chopper capabilities
|
||||
local unittype = _unit:GetTypeName()
|
||||
local capabilities = self:_GetUnitCapabilities(_unit) -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(_unit) -- #CTLD.UnitTypeCapabilities
|
||||
local cantroops = capabilities.troops
|
||||
local cancrates = capabilities.crates
|
||||
-- top menu
|
||||
local topmenu = MENU_GROUP:New(_group,"CTLD",nil)
|
||||
local toptroops = MENU_GROUP:New(_group,"Manage Troops",topmenu)
|
||||
local topcrates = MENU_GROUP:New(_group,"Manage Crates",topmenu)
|
||||
local toptroops = nil
|
||||
local topcrates = nil
|
||||
if cantroops then
|
||||
toptroops = MENU_GROUP:New(_group,"Manage Troops",topmenu)
|
||||
end
|
||||
if cancrates then
|
||||
topcrates = MENU_GROUP:New(_group,"Manage Crates",topmenu)
|
||||
end
|
||||
local listmenu = MENU_GROUP_COMMAND:New(_group,"List boarded cargo",topmenu, self._ListCargo, self, _group, _unit)
|
||||
local invtry = MENU_GROUP_COMMAND:New(_group,"Inventory",topmenu, self._ListInventory, self, _group, _unit)
|
||||
local rbcns = MENU_GROUP_COMMAND:New(_group,"List active zone beacons",topmenu, self._ListRadioBeacons, self, _group, _unit)
|
||||
@@ -4339,7 +4389,7 @@ end
|
||||
-- @param #number Trooplimit Unit can carry number of troops. Default 0.
|
||||
-- @param #number Length Unit lenght (in metres) for the load radius. Default 20.
|
||||
-- @param #number Maxcargoweight Maxmimum weight in kgs this helo can carry. Default 500.
|
||||
function CTLD:UnitCapabilities(Unittype, Cancrates, Cantroops, Cratelimit, Trooplimit, Length, Maxcargoweight)
|
||||
function CTLD:SetUnitCapabilities(Unittype, Cancrates, Cantroops, Cratelimit, Trooplimit, Length, Maxcargoweight)
|
||||
self:T(self.lid .. " UnitCapabilities")
|
||||
local unittype = nil
|
||||
local unit = nil
|
||||
@@ -4353,13 +4403,13 @@ end
|
||||
end
|
||||
local length = 20
|
||||
local maxcargo = 500
|
||||
local existingcaps = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||
local existingcaps = self.UnitTypeCapabilities[unittype] -- #CTLD.UnitTypeCapabilities
|
||||
if existingcaps then
|
||||
length = existingcaps.length or 20
|
||||
maxcargo = existingcaps.cargoweightlimit or 500
|
||||
end
|
||||
-- set capabilities
|
||||
local capabilities = {} -- #CTLD.UnitCapabilities
|
||||
local capabilities = {} -- #CTLD.UnitTypeCapabilities
|
||||
capabilities.type = unittype
|
||||
capabilities.crates = Cancrates or false
|
||||
capabilities.troops = Cantroops or false
|
||||
@@ -4367,10 +4417,26 @@ end
|
||||
capabilities.trooplimit = Trooplimit or 0
|
||||
capabilities.length = Length or length
|
||||
capabilities.cargoweightlimit = Maxcargoweight or maxcargo
|
||||
self.UnitTypes[unittype] = capabilities
|
||||
self.UnitTypeCapabilities[unittype] = capabilities
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Deprecated] - Function to add/adjust unittype capabilities. Has been replaced with `SetUnitCapabilities()` - pls use the new one going forward!
|
||||
-- @param #CTLD self
|
||||
-- @param #string Unittype The unittype to adjust. If passed as Wrapper.Unit#UNIT, it will search for the unit in the mission.
|
||||
-- @param #boolean Cancrates Unit can load crates. Default false.
|
||||
-- @param #boolean Cantroops Unit can load troops. Default false.
|
||||
-- @param #number Cratelimit Unit can carry number of crates. Default 0.
|
||||
-- @param #number Trooplimit Unit can carry number of troops. Default 0.
|
||||
-- @param #number Length Unit lenght (in metres) for the load radius. Default 20.
|
||||
-- @param #number Maxcargoweight Maxmimum weight in kgs this helo can carry. Default 500.
|
||||
function CTLD:UnitCapabilities(Unittype, Cancrates, Cantroops, Cratelimit, Trooplimit, Length, Maxcargoweight)
|
||||
self:I(self.lid.."This function been replaced with `SetUnitCapabilities()` - pls use the new one going forward!")
|
||||
self:SetUnitCapabilities(Unittype, Cancrates, Cantroops, Cratelimit, Trooplimit, Length, Maxcargoweight)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- (Internal) Check if a unit is hovering *in parameters*.
|
||||
-- @param #CTLD self
|
||||
-- @param Wrapper.Unit#UNIT Unit
|
||||
@@ -4523,7 +4589,7 @@ end
|
||||
local unittype = Unit:GetTypeName()
|
||||
local unitname = Unit:GetName()
|
||||
local Group = Unit:GetGroup()
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitTypeCapabilities
|
||||
local cancrates = capabilities.crates -- #boolean
|
||||
local cratelimit = capabilities.cratelimit -- #number
|
||||
if cancrates then
|
||||
|
||||
@@ -2934,7 +2934,11 @@ function FLIGHTCONTROL:_PlayerInfoATIS(groupname)
|
||||
|
||||
-- Radio message.
|
||||
self:TransmissionPilot(rtext, flight)
|
||||
self:TransmissionTower(srstxt,flight,10)
|
||||
if self.atis then
|
||||
self:TransmissionTower(srstxt,flight,10)
|
||||
else
|
||||
self:TransmissionTower(text,flight,10)
|
||||
end
|
||||
|
||||
else
|
||||
self:E(self.lid..string.format("Cannot find flight group %s.", tostring(groupname)))
|
||||
|
||||
@@ -2890,8 +2890,11 @@ function FLIGHTGROUP:_CheckGroupDone(delay, waittime)
|
||||
end
|
||||
|
||||
else
|
||||
-- Check if not parking (could be on ALERT5 and just spawned (current mission=nil)
|
||||
if not self:IsParking() then
|
||||
self:T(self.lid..string.format("Passed Final WP but Tasks=%d or Missions=%d left in the queue. Wait!", nTasks, nMissions))
|
||||
self:__Wait(-1)
|
||||
end
|
||||
end
|
||||
else
|
||||
self:T(self.lid..string.format("Passed Final WP but still have current Task (#%s) or Mission (#%s) left to do", tostring(self.taskcurrent), tostring(self.currentmission)))
|
||||
|
||||
@@ -1483,11 +1483,11 @@ function OPSZONE:_GetZoneColor()
|
||||
local color={0,0,0}
|
||||
|
||||
if self.ownerCurrent==coalition.side.NEUTRAL then
|
||||
color={1, 1, 1}
|
||||
color=self.ZoneOwnerNeutral or {1, 1, 1}
|
||||
elseif self.ownerCurrent==coalition.side.BLUE then
|
||||
color={0, 0, 1}
|
||||
color=self.ZoneOwnerBlue or {0, 0, 1}
|
||||
elseif self.ownerCurrent==coalition.side.RED then
|
||||
color={1, 0, 0}
|
||||
color=self.ZoneOwnerRed or {1, 0, 0}
|
||||
else
|
||||
|
||||
end
|
||||
@@ -1495,6 +1495,21 @@ function OPSZONE:_GetZoneColor()
|
||||
return color
|
||||
end
|
||||
|
||||
--- Set custom RGB color of zone depending on current owner.
|
||||
-- @param #OPSZONE self
|
||||
-- @param #table Neutral Color is a table of RGB values 0..1 for Red, Green, and Blue respectively, e.g. {1,0,0} for red.
|
||||
-- @param #table Blue Color is a table of RGB values 0..1 for Red, Green, and Blue respectively, e.g. {0,1,0} for green.
|
||||
-- @param #table Red Color is a table of RGB values 0..1 for Red, Green, and Blue respectively, e.g. {0,0,1} for blue.
|
||||
-- @return #OPSZONE self
|
||||
function OPSZONE:SetZoneColor(Neutral, Blue, Red)
|
||||
|
||||
self.ZoneOwnerNeutral = Neutral or {1, 1, 1}
|
||||
self.ZoneOwnerBlue = Blue or {0, 0, 1}
|
||||
self.ZoneOwnerRed = Red or {1, 0, 0}
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Update marker on the F10 map.
|
||||
-- @param #OPSZONE self
|
||||
function OPSZONE:_UpdateMarker()
|
||||
|
||||
@@ -104,7 +104,7 @@ PLAYERRECCE = {
|
||||
ClassName = "PLAYERRECCE",
|
||||
verbose = true,
|
||||
lid = nil,
|
||||
version = "0.0.21",
|
||||
version = "0.0.22",
|
||||
ViewZone = {},
|
||||
ViewZoneVisual = {},
|
||||
ViewZoneLaser = {},
|
||||
@@ -469,8 +469,10 @@ function PLAYERRECCE:_GetClockDirection(unit, target)
|
||||
local _playerPosition = unit:GetCoordinate() -- get position of helicopter
|
||||
local _targetpostions = target:GetCoordinate() -- get position of downed pilot
|
||||
local _heading = unit:GetHeading() -- heading
|
||||
--self:I("Heading = ".._heading)
|
||||
local DirectionVec3 = _playerPosition:GetDirectionVec3( _targetpostions )
|
||||
local Angle = _playerPosition:GetAngleDegrees( DirectionVec3 )
|
||||
--self:I("Angle = "..Angle)
|
||||
local clock = 12
|
||||
local hours = 0
|
||||
if _heading and Angle then
|
||||
@@ -478,10 +480,13 @@ function PLAYERRECCE:_GetClockDirection(unit, target)
|
||||
--if angle == 0 then angle = 360 end
|
||||
clock = _heading-Angle
|
||||
hours = (clock/30)*-1
|
||||
--self:I("hours = "..hours)
|
||||
clock = 12+hours
|
||||
clock = UTILS.Round(clock,0)
|
||||
if clock > 12 then clock = clock-12 end
|
||||
end
|
||||
if clock == 0 then clock = 12 end
|
||||
end
|
||||
--self:I("Clock ="..clock)
|
||||
return clock
|
||||
end
|
||||
|
||||
@@ -709,8 +714,8 @@ function PLAYERRECCE:_GetViewZone(unit, vheading, minview, maxview, angle, camon
|
||||
local heading2 = (vheading-90)%360
|
||||
self:T({heading1,heading2})
|
||||
local startpos = startp:Translate(minview,vheading)
|
||||
local pos1 = startpos:Translate(10,heading1)
|
||||
local pos2 = startpos:Translate(10,heading2)
|
||||
local pos1 = startpos:Translate(12.5,heading1)
|
||||
local pos2 = startpos:Translate(12.5,heading2)
|
||||
local pos3 = pos1:Translate(maxview,vheading)
|
||||
local pos4 = pos2:Translate(maxview,vheading)
|
||||
local array = {}
|
||||
@@ -912,32 +917,41 @@ function PLAYERRECCE:_LaseTarget(client,targetset)
|
||||
else
|
||||
laser = self.LaserSpots[playername]
|
||||
end
|
||||
-- old target
|
||||
if self.LaserTarget[playername] then
|
||||
-- still looking at target?
|
||||
local target=self.LaserTarget[playername] -- Ops.Target#TARGET
|
||||
local oldtarget = target:GetObject() --or laser.Target
|
||||
--self:I("Targetstate: "..target:GetState())
|
||||
--self:I("Laser State: "..tostring(laser:IsLasing()))
|
||||
if not oldtarget or targetset:IsNotInSet(oldtarget) or target:IsDead() or target:IsDestroyed() then
|
||||
self:T("Targetstate: "..target:GetState())
|
||||
self:T("Laser State: "..tostring(laser:IsLasing()))
|
||||
if (not oldtarget) or targetset:IsNotInSet(oldtarget) or target:IsDead() or target:IsDestroyed() then
|
||||
-- lost LOS or dead
|
||||
laser:LaseOff()
|
||||
if target:IsDead() or target:IsDestroyed() or target:GetLife() < 2 then
|
||||
self:__Shack(-1,client,oldtarget)
|
||||
self.LaserTarget[playername] = nil
|
||||
--self.LaserTarget[playername] = nil
|
||||
else
|
||||
self:__TargetLOSLost(-1,client,oldtarget)
|
||||
self.LaserTarget[playername] = nil
|
||||
--self.LaserTarget[playername] = nil
|
||||
end
|
||||
end
|
||||
if oldtarget and (not laser:IsLasing()) then
|
||||
--self:I("Switching laser back on ..")
|
||||
self.LaserTarget[playername] = nil
|
||||
oldtarget = nil
|
||||
self.LaserSpots[playername] = nil
|
||||
elseif oldtarget and laser and (not laser:IsLasing()) then
|
||||
--laser:LaseOff()
|
||||
self:T("Switching laser back on ..")
|
||||
local lasercode = self.UnitLaserCodes[playername] or laser.LaserCode or 1688
|
||||
local lasingtime = self.lasingtime or 60
|
||||
--local targettype = target:GetTypeName()
|
||||
laser:LaseOn(oldtarget,lasercode,lasingtime)
|
||||
--self:__TargetLasing(-1,client,oldtarget,lasercode,lasingtime)
|
||||
else
|
||||
-- we should not be here...
|
||||
self:T("Target alive and laser is on!")
|
||||
--self.LaserSpots[playername] = nil
|
||||
end
|
||||
elseif not laser:IsLasing() and target then
|
||||
-- new target
|
||||
elseif (not laser:IsLasing()) and target then
|
||||
local relativecam = self.LaserRelativePos[client:GetTypeName()]
|
||||
laser:SetRelativeStartPosition(relativecam)
|
||||
local lasercode = self.UnitLaserCodes[playername] or laser.LaserCode or 1688
|
||||
@@ -945,7 +959,7 @@ function PLAYERRECCE:_LaseTarget(client,targetset)
|
||||
--local targettype = target:GetTypeName()
|
||||
laser:LaseOn(target,lasercode,lasingtime)
|
||||
self.LaserTarget[playername] = TARGET:New(target)
|
||||
self.LaserTarget[playername].TStatus = 9
|
||||
--self.LaserTarget[playername].TStatus = 9
|
||||
self:__TargetLasing(-1,client,target,lasercode,lasingtime)
|
||||
end
|
||||
return self
|
||||
@@ -1027,6 +1041,13 @@ function PLAYERRECCE:_SwitchLasing(client,group,playername)
|
||||
MESSAGE:New("Lasing is now ON",10,self.Name or "FACA"):ToClient(client)
|
||||
else
|
||||
self.AutoLase[playername] = false
|
||||
if self.LaserSpots[playername] then
|
||||
local laser = self.LaserSpots[playername] -- Core.Spot#SPOT
|
||||
if laser:IsLasing() then
|
||||
laser:LaseOff()
|
||||
end
|
||||
self.LaserSpots[playername] = nil
|
||||
end
|
||||
MESSAGE:New("Lasing is now OFF",10,self.Name or "FACA"):ToClient(client)
|
||||
end
|
||||
if self.ClientMenus[playername] then
|
||||
@@ -1681,7 +1702,7 @@ function PLAYERRECCE:onafterRecceOnStation(From, Event, To, Client, Playername)
|
||||
local text2tts = string.format("All stations, FACA %s on station at %s!",callsign, coordtext)
|
||||
text2tts = self:_GetTextForSpeech(text2tts)
|
||||
if self.debug then
|
||||
self:I(text2.."\n"..text2tts)
|
||||
self:T(text2.."\n"..text2tts)
|
||||
end
|
||||
if self.UseSRS then
|
||||
local grp = Client:GetGroup()
|
||||
@@ -1720,7 +1741,7 @@ function PLAYERRECCE:onafterRecceOffStation(From, Event, To, Client, Playername)
|
||||
local texttts = string.format("All stations, FACA %s leaving station at %s, good bye!",callsign, coordtext)
|
||||
texttts = self:_GetTextForSpeech(texttts)
|
||||
if self.debug then
|
||||
self:I(text.."\n"..texttts)
|
||||
self:T(text.."\n"..texttts)
|
||||
end
|
||||
local text1 = "Going home!"
|
||||
if self.UseSRS then
|
||||
|
||||
@@ -1579,7 +1579,7 @@ function PLAYERTASKCONTROLLER:New(Name, Coalition, Type, ClientFilter)
|
||||
self.ClusterRadius = 0.5
|
||||
self.TargetRadius = 500
|
||||
|
||||
self.ClientFilter = ClientFilter or ""
|
||||
self.ClientFilter = ClientFilter --or ""
|
||||
|
||||
self.TargetQueue = FIFO:New() -- Utilities.FiFo#FIFO
|
||||
self.TaskQueue = FIFO:New() -- Utilities.FiFo#FIFO
|
||||
|
||||
Reference in New Issue
Block a user