#CLIENTMENUMANAGER Add a retry loop if possibly client not yet exists in Database

This commit is contained in:
Applevangelist 2025-01-05 17:44:32 +01:00
parent 8d603a0cef
commit 45dd7117c7

View File

@ -20,7 +20,7 @@
--
-- @module Core.ClientMenu
-- @image Core_Menu.JPG
-- last change: May 2024
-- last change: Jan 2025
-- TODO
----------------------------------------------------------------------------------------------------------------
@ -59,7 +59,7 @@
CLIENTMENU = {
ClassName = "CLIENTMENUE",
lid = "",
version = "0.1.2",
version = "0.1.3",
name = nil,
path = nil,
group = nil,
@ -455,7 +455,7 @@ end
-- @param #CLIENTMENUMANAGER self
-- @param Core.Event#EVENTDATA EventData
-- @return #CLIENTMENUMANAGER self
function CLIENTMENUMANAGER:_EventHandler(EventData)
function CLIENTMENUMANAGER:_EventHandler(EventData,Retry)
self:T(self.lid.."_EventHandler: "..EventData.id)
--self:I(self.lid.."_EventHandler: "..tostring(EventData.IniPlayerName))
if EventData.id == EVENTS.PlayerLeaveUnit or EventData.id == EVENTS.Ejection or EventData.id == EVENTS.Crash or EventData.id == EVENTS.PilotDead then
@ -468,6 +468,10 @@ function CLIENTMENUMANAGER:_EventHandler(EventData)
if EventData.IniPlayerName and EventData.IniGroup then
if (not self.clientset:IsIncludeObject(_DATABASE:FindClient( EventData.IniUnitName ))) then
self:T(self.lid.."Client not in SET: "..EventData.IniPlayerName)
if not Retry then
-- try again in 2 secs
self:ScheduleOnce(2,CLIENTMENUMANAGER._EventHandler,self,EventData,true)
end
return self
end
--self:I(self.lid.."Join event for player: "..EventData.IniPlayerName)
@ -524,7 +528,7 @@ function CLIENTMENUMANAGER:InitAutoPropagation()
self:HandleEvent(EVENTS.PilotDead, self._EventHandler)
self:HandleEvent(EVENTS.PlayerEnterAircraft, self._EventHandler)
self:HandleEvent(EVENTS.PlayerEnterUnit, self._EventHandler)
self:SetEventPriority(5)
self:SetEventPriority(6)
return self
end