mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
fixes and additions
This commit is contained in:
parent
c73d8a6339
commit
c4738b24eb
@ -815,10 +815,11 @@ end
|
|||||||
--- Adds a CLIENT based on the ClientName in the DATABASE.
|
--- Adds a CLIENT based on the ClientName in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ClientName Name of the Client unit.
|
-- @param #string ClientName Name of the Client unit.
|
||||||
|
-- @param #boolean Force (optional) Force registration of client.
|
||||||
-- @return Wrapper.Client#CLIENT The client object.
|
-- @return Wrapper.Client#CLIENT The client object.
|
||||||
function DATABASE:AddClient( ClientName )
|
function DATABASE:AddClient( ClientName, Force )
|
||||||
|
|
||||||
if not self.CLIENTS[ClientName] then
|
if not self.CLIENTS[ClientName] or Force == true then
|
||||||
self.CLIENTS[ClientName] = CLIENT:Register( ClientName )
|
self.CLIENTS[ClientName] = CLIENT:Register( ClientName )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1579,8 +1580,8 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
self:I(string.format("Player '%s' joined unit '%s' of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
|
self:I(string.format("Player '%s' joined unit '%s' of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
|
||||||
|
|
||||||
-- Add client in case it does not exist already.
|
-- Add client in case it does not exist already.
|
||||||
if not client then
|
if client == nil or (client and client:CountPlayers() == 0) then
|
||||||
client=self:AddClient(Event.IniDCSUnitName)
|
client=self:AddClient(Event.IniDCSUnitName, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add player.
|
-- Add player.
|
||||||
|
|||||||
@ -1695,6 +1695,7 @@ do -- AI
|
|||||||
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
|
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
|
||||||
-- @field ENGAGE_AIR_WEAPONS
|
-- @field ENGAGE_AIR_WEAPONS
|
||||||
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
||||||
|
-- @field EVASION_OF_ARM
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @type AI.Option.Ground.mid -- Moose added
|
-- @type AI.Option.Ground.mid -- Moose added
|
||||||
|
|||||||
@ -201,6 +201,13 @@ function CLIENT:AddPlayer(PlayerName)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get number of associated players.
|
||||||
|
-- @param #CLIENT self
|
||||||
|
-- @return #number Count
|
||||||
|
function CLIENT:CountPlayers()
|
||||||
|
return #self.Players or 0
|
||||||
|
end
|
||||||
|
|
||||||
--- Get player name(s).
|
--- Get player name(s).
|
||||||
-- @param #CLIENT self
|
-- @param #CLIENT self
|
||||||
-- @return #table List of player names or an empty table `{}`.
|
-- @return #table List of player names or an empty table `{}`.
|
||||||
@ -608,4 +615,3 @@ function CLIENT:GetPlayerInfo(Attribute)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -3811,6 +3811,48 @@ function CONTROLLABLE:OptionProhibitAfterburner( Prohibit )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [Ground] Allows AI radar units to take defensive actions to avoid anti radiation missiles. Units are allowed to shut radar off and displace.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number Seconds Can be - nil, 0 or false = switch off this option, any positive number = number of seconds the escape sequency runs.
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionEvasionOfARM(Seconds)
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
if DCSControllable then
|
||||||
|
local Controller = self:_GetController()
|
||||||
|
|
||||||
|
if self:IsGround() then
|
||||||
|
if Seconds == nil then Seconds = false end
|
||||||
|
Controller:setOption( AI.Option.Ground.id.EVASION_OF_ARM, Seconds)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [Ground] Option that defines the vehicle spacing when in an on road and off road formation.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number meters Can be zero to 100 meters. Defaults to 50 meters.
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionFormationInterval(meters)
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
if DCSControllable then
|
||||||
|
local Controller = self:_GetController()
|
||||||
|
|
||||||
|
if self:IsGround() then
|
||||||
|
if meters == nil or meters > 100 or meters < 0 then meters = 50 end
|
||||||
|
Controller:setOption( 30, meters)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- [Air] Defines the usage of Electronic Counter Measures by airborne forces.
|
--- [Air] Defines the usage of Electronic Counter Measures by airborne forces.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param #number ECMvalue Can be - 0=Never on, 1=if locked by radar, 2=if detected by radar, 3=always on, defaults to 1
|
-- @param #number ECMvalue Can be - 0=Never on, 1=if locked by radar, 2=if detected by radar, 3=always on, defaults to 1
|
||||||
|
|||||||
@ -149,7 +149,7 @@ STORAGE.Liquid = {
|
|||||||
|
|
||||||
--- STORAGE class version.
|
--- STORAGE class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
STORAGE.version="0.0.1"
|
STORAGE.version="0.0.2"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -162,7 +162,7 @@ STORAGE.version="0.0.1"
|
|||||||
-- Constructor
|
-- Constructor
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- Create a new STORAGE object from the DCS weapon object.
|
--- Create a new STORAGE object from the DCS airbase object.
|
||||||
-- @param #STORAGE self
|
-- @param #STORAGE self
|
||||||
-- @param #string AirbaseName Name of the airbase.
|
-- @param #string AirbaseName Name of the airbase.
|
||||||
-- @return #STORAGE self
|
-- @return #STORAGE self
|
||||||
@ -182,8 +182,28 @@ function STORAGE:New(AirbaseName)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Create a new STORAGE object from an DCS static cargo object.
|
||||||
|
-- @param #STORAGE self
|
||||||
|
-- @param #string StaticCargoName Unit name of the static.
|
||||||
|
-- @return #STORAGE self
|
||||||
|
function STORAGE:NewFromStaticCargo(StaticCargoName)
|
||||||
|
|
||||||
--- Find a STORAGE in the **_DATABASE** using the name associated airbase.
|
-- Inherit everything from BASE class.
|
||||||
|
local self=BASE:Inherit(self, BASE:New()) -- #STORAGE
|
||||||
|
|
||||||
|
self.airbase=StaticObject.getByName(StaticCargoName)
|
||||||
|
|
||||||
|
if Airbase.getWarehouse then
|
||||||
|
self.warehouse=Warehouse.getCargoAsWarehouse(self.airbase)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.lid = string.format("STORAGE %s", StaticCargoName)
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Airbases only - Find a STORAGE in the **_DATABASE** using the name associated airbase.
|
||||||
-- @param #STORAGE self
|
-- @param #STORAGE self
|
||||||
-- @param #string AirbaseName The Airbase Name.
|
-- @param #string AirbaseName The Airbase Name.
|
||||||
-- @return #STORAGE self
|
-- @return #STORAGE self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user