Merge branch 'develop' into FF/Ops

This commit is contained in:
Frank
2023-11-17 18:04:49 +01:00
188 changed files with 4510 additions and 404 deletions

View File

@@ -929,7 +929,7 @@ end
function AIRBASE:GetWarehouse()
local warehouse=nil --DCS#Warehouse
local airbase=self:GetDCSObject()
if airbase then
if airbase and Airbase.getWarehouse then
warehouse=airbase:getWarehouse()
end
return warehouse
@@ -1773,7 +1773,7 @@ function AIRBASE:_CheckParkingLists(TerminalID)
end
--- Helper function to check for the correct terminal type including "artificial" ones.
-- @param #number Term_Type Termial type from getParking routine.
-- @param #number Term_Type Terminal type from getParking routine.
-- @param #AIRBASE.TerminalType termtype Terminal type from AIRBASE.TerminalType enumerator.
-- @return #boolean True if terminal types match.
function AIRBASE._CheckTerminalType(Term_Type, termtype)

View File

@@ -323,7 +323,7 @@ function CLIENT:Alive( CallBackFunction, ... )
return self
end
--- @param #CLIENT self
-- @param #CLIENT self
function CLIENT:_AliveCheckScheduler( SchedulerName )
self:F3( { SchedulerName, self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
@@ -531,8 +531,6 @@ function CLIENT:ShowCargo()
end
--- The main message driver for the CLIENT.
-- This function displays various messages to the Player logged into the CLIENT through the DCS World Messaging system.
-- @param #CLIENT self
@@ -578,3 +576,36 @@ function CLIENT:Message( Message, MessageDuration, MessageCategory, MessageInter
end
end
end
--- [Multi-Player Server] Get UCID from a CLIENT.
-- @param #CLIENT self
-- @return #string UCID
function CLIENT:GetUCID()
local PID = NET.GetPlayerIDByName(nil,self:GetPlayerName())
return net.get_player_info(tonumber(PID), 'ucid')
end
--- [Multi-Player Server] Return a table of attributes from CLIENT. If optional attribute is present, only that value is returned.
-- @param #CLIENT self
-- @param #string Attribute (Optional) The attribute to obtain. List see below.
-- @return #table PlayerInfo or nil if it cannot be found
-- @usage
-- Returned table holds these attributes:
--
-- 'id' : player ID
-- 'name' : player name
-- 'side' : 0 - spectators, 1 - red, 2 - blue
-- 'slot' : slot ID of the player or
-- 'ping' : ping of the player in ms
-- 'ipaddr': IP address of the player, SERVER ONLY
-- 'ucid' : Unique Client Identifier, SERVER ONLY
--
function CLIENT:GetPlayerInfo(Attribute)
local PID = NET.GetPlayerIDByName(nil,self:GetPlayerName())
if PID then
return net.get_player_info(tonumber(PID), Attribute)
else
return nil
end
end

View File

@@ -31,7 +31,8 @@
-- ### Contributions:
--
-- * **Entropy**, **Afinegan**: Came up with the requirement for AIOnOff().
--
-- * **Applevangelist**: various
--
-- ===
--
-- @module Wrapper.Group
@@ -45,12 +46,16 @@
--- Wrapper class of the DCS world Group object.
--
-- ## Finding groups
--
-- The GROUP class provides the following functions to retrieve quickly the relevant GROUP instance:
--
-- * @{#GROUP.Find}(): Find a GROUP instance from the global _DATABASE object (an instance of @{Core.Database#DATABASE}) using a DCS Group object.
-- * @{#GROUP.FindByName}(): Find a GROUP instance from the global _DATABASE object (an instance of @{Core.Database#DATABASE}) using a DCS Group name.
-- * @{#GROUP.FindByMatching}(): Find a GROUP instance from the global _DATABASE object (an instance of @{Core.Database#DATABASE}) using pattern matching.
-- * @{#GROUP.FindAllByMatching}(): Find all GROUP instances from the global _DATABASE object (an instance of @{Core.Database#DATABASE}) using pattern matching.
--
-- # 1. Tasking of groups
-- ## Tasking of groups
--
-- A GROUP is derived from the wrapper class CONTROLLABLE (@{Wrapper.Controllable#CONTROLLABLE}).
-- See the @{Wrapper.Controllable} task methods section for a description of the task methods.
@@ -285,7 +290,7 @@ function GROUP:Find( DCSGroup )
return GroupFound
end
--- Find the created GROUP using the DCS Group Name.
--- Find a GROUP using the DCS Group Name.
-- @param #GROUP self
-- @param #string GroupName The DCS Group Name.
-- @return #GROUP The GROUP.
@@ -295,6 +300,55 @@ function GROUP:FindByName( GroupName )
return GroupFound
end
--- Find the first(!) GROUP matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
-- @param #GROUP self
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)) for regular expressions in LUA.
-- @return #GROUP The GROUP.
-- @usage
-- -- Find a group with a partial group name
-- local grp = GROUP:FindByMatching( "Apple" )
-- -- will return e.g. a group named "Apple-1-1"
--
-- -- using a pattern
-- local grp = GROUP:FindByMatching( ".%d.%d$" )
-- -- will return the first group found ending in "-1-1" to "-9-9", but not e.g. "-10-1"
function GROUP:FindByMatching( Pattern )
local GroupFound = nil
for name,group in pairs(_DATABASE.GROUPS) do
if string.match(name, Pattern ) then
GroupFound = group
break
end
end
return GroupFound
end
--- Find all GROUP objects matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
-- @param #GROUP self
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)) for regular expressions in LUA.
-- @return #table Groups Table of matching #GROUP objects found
-- @usage
-- -- Find all group with a partial group name
-- local grptable = GROUP:FindAllByMatching( "Apple" )
-- -- will return all groups with "Apple" in the name
--
-- -- using a pattern
-- local grp = GROUP:FindAllByMatching( ".%d.%d$" )
-- -- will return the all groups found ending in "-1-1" to "-9-9", but not e.g. "-10-1" or "-1-10"
function GROUP:FindAllByMatching( Pattern )
local GroupsFound = {}
for name,group in pairs(_DATABASE.GROUPS) do
if string.match(name, Pattern ) then
GroupsFound[#GroupsFound+1] = group
end
end
return GroupsFound
end
-- DCS Group methods support.
--- Returns the DCS Group.

View File

@@ -5,7 +5,7 @@
-- ===
--
-- ### Author: **Applevangelist**
-- # Last Update June 2023
-- # Last Update Oct 2023
--
-- ===
--
@@ -43,7 +43,7 @@ do
-- @field #NET
NET = {
ClassName = "NET",
Version = "0.1.2",
Version = "0.1.3",
BlockTime = 600,
BlockedPilots = {},
BlockedUCIDs = {},
@@ -470,11 +470,9 @@ end
-- @return #number PlayerID or nil
function NET:GetPlayerIDByName(Name)
if not Name then return nil end
local playerList = self:GetPlayerList()
self:T({playerList})
local playerList = net.get_player_list()
for i=1,#playerList do
local playerName = net.get_name(i)
self:T({playerName})
if playerName == Name then
return playerList[i]
end

View File

@@ -4,7 +4,7 @@
--
-- ### Author: **FlightControl**
--
-- ### Contributions:
-- ### Contributions: **funkyfranky
--
-- ===
--
@@ -12,12 +12,13 @@
-- @image MOOSE.JPG
--- @type OBJECT
--- OBJECT class.
-- @type OBJECT
-- @extends Core.Base#BASE
-- @field #string ObjectName The name of the Object.
--- Wrapper class to hendle the DCS Object objects.
--- Wrapper class to handle the DCS Object objects.
--
-- * Support all DCS Object APIs.
-- * Enhance with Object specific APIs not in the DCS Object API set.
@@ -43,9 +44,15 @@ OBJECT = {
-- @param #OBJECT self
-- @param DCS#Object ObjectName The Object name
-- @return #OBJECT self
function OBJECT:New( ObjectName, Test )
function OBJECT:New( ObjectName)
-- Inherit BASE class.
local self = BASE:Inherit( self, BASE:New() )
-- Debug output.
self:F2( ObjectName )
-- Set object name.
self.ObjectName = ObjectName
return self
@@ -64,15 +71,14 @@ function OBJECT:GetID()
return ObjectID
end
BASE:E( { "Cannot GetID", Name = self.ObjectName, Class = self:GetClassName() } )
self:E( { "Cannot GetID", Name = self.ObjectName, Class = self:GetClassName() } )
return nil
end
--- Destroys the OBJECT.
-- @param #OBJECT self
-- @return #boolean true if the object is destroyed.
-- @return #nil The DCS Unit is not existing or alive.
-- @return #boolean Returns `true` if the object is destroyed or #nil if the object is nil.
function OBJECT:Destroy()
local DCSObject = self:GetDCSObject()
@@ -83,7 +89,7 @@ function OBJECT:Destroy()
return true
end
BASE:E( { "Cannot Destroy", Name = self.ObjectName, Class = self:GetClassName() } )
self:E( { "Cannot Destroy", Name = self.ObjectName, Class = self:GetClassName() } )
return nil
end

View File

@@ -168,8 +168,10 @@ function STORAGE:New(AirbaseName)
local self=BASE:Inherit(self, BASE:New()) -- #STORAGE
self.airbase=Airbase.getByName(AirbaseName)
self.warehouse=self.airbase:getWarehouse()
if Airbase.getWarehouse then
self.warehouse=self.airbase:getWarehouse()
end
self.lid = string.format("STORAGE %s", AirbaseName)

View File

@@ -13,7 +13,7 @@
--
-- ### Author: **FlightControl**
--
-- ### Contributions: **funkyfranky**
-- ### Contributions: **funkyfranky**, **Applevangelist**
--
-- ===
--
@@ -42,6 +42,8 @@
--
-- * @{#UNIT.Find}(): Find a UNIT instance from the global _DATABASE object (an instance of @{Core.Database#DATABASE}) using a DCS Unit object.
-- * @{#UNIT.FindByName}(): Find a UNIT instance from the global _DATABASE object (an instance of @{Core.Database#DATABASE}) using a DCS Unit name.
-- * @{#UNIT.FindByMatching}(): Find a UNIT instance from the global _DATABASE object (an instance of @{Core.Database#DATABASE}) using a pattern.
-- * @{#UNIT.FindAllByMatching}(): Find all UNIT instances from the global _DATABASE object (an instance of @{Core.Database#DATABASE}) using a pattern.
--
-- IMPORTANT: ONE SHOULD NEVER SANITIZE these UNIT OBJECT REFERENCES! (make the UNIT object references nil).
--
@@ -160,6 +162,55 @@ function UNIT:FindByName( UnitName )
return UnitFound
end
--- Find the first(!) UNIT matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
-- @param #UNIT self
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)) for regular expressions in LUA.
-- @return #UNIT The UNIT.
-- @usage
-- -- Find a group with a partial group name
-- local unit = UNIT:FindByMatching( "Apple" )
-- -- will return e.g. a group named "Apple-1-1"
--
-- -- using a pattern
-- local unit = UNIT:FindByMatching( ".%d.%d$" )
-- -- will return the first group found ending in "-1-1" to "-9-9", but not e.g. "-10-1"
function UNIT:FindByMatching( Pattern )
local GroupFound = nil
for name,group in pairs(_DATABASE.UNITS) do
if string.match(name, Pattern ) then
GroupFound = group
break
end
end
return GroupFound
end
--- Find all UNIT objects matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
-- @param #UNIT self
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)) for regular expressions in LUA.
-- @return #table Units Table of matching #UNIT objects found
-- @usage
-- -- Find all group with a partial group name
-- local unittable = UNIT:FindAllByMatching( "Apple" )
-- -- will return all units with "Apple" in the name
--
-- -- using a pattern
-- local unittable = UNIT:FindAllByMatching( ".%d.%d$" )
-- -- will return the all units found ending in "-1-1" to "-9-9", but not e.g. "-10-1" or "-1-10"
function UNIT:FindAllByMatching( Pattern )
local GroupsFound = {}
for name,group in pairs(_DATABASE.UNITS) do
if string.match(name, Pattern ) then
GroupsFound[#GroupsFound+1] = group
end
end
return GroupsFound
end
--- Return the name of the UNIT.
-- @param #UNIT self
-- @return #string The UNIT name.

View File

@@ -367,7 +367,7 @@ function WEAPON:GetTarget()
if object then
-- Get object category.
local category=object:getCategory()
local category=Object.getCategory(object)
--Target name
local name=object:getName()