mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
500a7f938f
@ -173,7 +173,8 @@
|
||||
-- @image Core_Event.JPG
|
||||
|
||||
|
||||
--- @type EVENT
|
||||
---
|
||||
-- @type EVENT
|
||||
-- @field #EVENT.Events Events
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
@ -282,6 +283,7 @@ EVENTS = {
|
||||
-- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
|
||||
-- @field #string IniGroupName UNIT) The initiating GROUP name (same as IniDCSGroupName).
|
||||
-- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
|
||||
-- @field #string IniPlayerUCID (UNIT) The UCID of the initiating player in case the Unit is a client or player slot and on a multi-player server.
|
||||
-- @field DCS#coalition.side IniCoalition (UNIT) The coalition of the initiator.
|
||||
-- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator.
|
||||
-- @field #string IniTypeName (UNIT) The type name of the initiator.
|
||||
@ -297,6 +299,7 @@ EVENTS = {
|
||||
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
|
||||
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
|
||||
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
|
||||
-- @field #string TgtPlayerUCID (UNIT) The UCID of the target player in case the Unit is a client or player slot and on a multi-player server.
|
||||
-- @field DCS#coalition.side TgtCoalition (UNIT) The coalition of the target.
|
||||
-- @field DCS#Unit.Category TgtCategory (UNIT) The category of the target.
|
||||
-- @field #string TgtTypeName (UNIT) The type name of the target.
|
||||
@ -1143,6 +1146,14 @@ function EVENT:onEvent( Event )
|
||||
end
|
||||
|
||||
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
|
||||
if Event.IniPlayerName then
|
||||
-- get UUCID
|
||||
local PID = NET.GetPlayerIDByName(nil,Event.IniPlayerName)
|
||||
if PID then
|
||||
Event.IniPlayerUCID = net.get_player_info(tonumber(PID), 'ucid')
|
||||
--env.info("Event.IniPlayerUCID="..tostring(Event.IniPlayerUCID),false)
|
||||
end
|
||||
end
|
||||
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
||||
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||
@ -1215,6 +1226,14 @@ function EVENT:onEvent( Event )
|
||||
Event.TgtGroupName = Event.TgtDCSGroupName
|
||||
end
|
||||
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
|
||||
if Event.TgtPlayerName then
|
||||
-- get UUCID
|
||||
local PID = NET.GetPlayerIDByName(nil,Event.TgtPlayerName)
|
||||
if PID then
|
||||
Event.TgtPlayerUCID = net.get_player_info(tonumber(PID), 'ucid')
|
||||
--env.info("Event.TgtPlayerUCID="..tostring(Event.TgtPlayerUCID),false)
|
||||
end
|
||||
end
|
||||
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
||||
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
||||
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user