This commit is contained in:
FullGas1 2025-03-29 23:06:27 +01:00
parent e0e4279f20
commit 601805abb0

View File

@ -8192,14 +8192,11 @@ function ctld.eventHandler:onEvent(event)
return
end
local function processHumanPlayer(mistDBsHumansByName)
local function processHumanPlayer()
ctld.logTrace("in the 'processHumanPlayer' function processHumanPlayer()- unitName = %s", ctld.p(unitName))
ctld.logTrace("in the 'processHumanPlayer' function processHumanPlayer()- mist.DBs.humansByName[unitName] = %s", ctld.p(mist.DBs.humansByName[unitName]))
ctld.logTrace("in the 'processHumanPlayer' function processHumanPlayer()- mist.DBs.humansByName = %s", ctld.p(mist.DBs.humansByName))
ctld.logTrace("in the 'processHumanPlayer' function processHumanPlayer()- mistDBsHumansByName[unitName] = %s", ctld.p(mistDBsHumansByName[unitName]))
ctld.logTrace("in the 'processHumanPlayer' function processHumanPlayer()- mistDBsHumansByName = %s", ctld.p(mistDBsHumansByName))
--if mist.DBs.humansByName[unitName] then -- it's a human unit
if mistDBsHumansByName[unitName] then -- it's a human unit
if mist.DBs.humansByName[unitName] then -- it's a human unit
ctld.logDebug("caught event %s for human unit [%s]", ctld.p(eventName), ctld.p(unitName))
local _unit = Unit.getByName(unitName)
if _unit ~= nil then
@ -8238,13 +8235,13 @@ function ctld.eventHandler:onEvent(event)
if not mist.DBs.humansByName[unitName] then
-- give a few milliseconds for MiST to handle the BIRTH event too
ctld.logTrace("give MiST some time to handle the BIRTH event too")
timer.scheduleFunction(function(mistDBsHumansByName, t)
timer.scheduleFunction(function()
ctld.logTrace("calling the 'processHumanPlayer' function in a timer")
processHumanPlayer(mistDBsHumansByName)
end, {mist.DBs.humansByName}, timer.getTime() + 0.5)
processHumanPlayer()
end, nil, timer.getTime() + 1)
else
ctld.logTrace("calling the 'processHumanPlayer' function immediately")
processHumanPlayer(mist.DBs.humansByName)
processHumanPlayer()
end
end