mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed abort logic and trace overhead on menus
This commit is contained in:
parent
02e2f21ec6
commit
82477c93d2
@ -810,9 +810,9 @@ do
|
||||
-- @param MenuTime
|
||||
-- @return #MENU_GROUP self
|
||||
function MENU_GROUP:RemoveSubMenus( MenuTime )
|
||||
self:F2( { self.MenuPath, MenuTime, self.MenuTime } )
|
||||
--self:F2( { self.MenuPath, MenuTime, self.MenuTime } )
|
||||
|
||||
self:T( { "Removing Group SubMenus:", self.MenuGroup:GetName(), self.MenuPath } )
|
||||
--self:T( { "Removing Group SubMenus:", self.MenuGroup:GetName(), self.MenuPath } )
|
||||
for MenuText, Menu in pairs( self.Menus ) do
|
||||
Menu:Remove( MenuTime )
|
||||
end
|
||||
@ -825,7 +825,7 @@ do
|
||||
-- @param MenuTime
|
||||
-- @return #nil
|
||||
function MENU_GROUP:Remove( MenuTime )
|
||||
self:F( { self.MenuGroupID, self.MenuPath, MenuTime, self.MenuTime } )
|
||||
--self:F2( { self.MenuGroupID, self.MenuPath, MenuTime, self.MenuTime } )
|
||||
|
||||
self:RemoveSubMenus( MenuTime )
|
||||
|
||||
@ -844,7 +844,7 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
self:T( { "Removing Group Menu:", self.MenuGroup:GetName(), self.MenuGroup._Menus[self.Path].Path } )
|
||||
self:T( { "Removing Group Menu:", MenuGroup = self.MenuGroup:GetName(), MenuPath = self.MenuGroup._Menus[self.Path].Path } )
|
||||
self.MenuGroup._Menus[self.Path] = nil
|
||||
self = nil
|
||||
end
|
||||
@ -896,7 +896,7 @@ do
|
||||
self.MenuText = MenuText
|
||||
self.ParentMenu = ParentMenu
|
||||
|
||||
self:T( { "Adding Group Command Menu:", MenuGroup:GetName(), MenuText, self.MenuParentPath } )
|
||||
self:T( { "Adding Group Command Menu:", MenuGroup = MenuGroup:GetName(), MenuText = MenuText, MenuPath = self.MenuParentPath } )
|
||||
self.MenuPath = missionCommands.addCommandForGroup( self.MenuGroupID, MenuText, self.MenuParentPath, self.MenuCallHandler, arg )
|
||||
|
||||
if self.ParentMenu and self.ParentMenu.Menus then
|
||||
@ -914,14 +914,14 @@ do
|
||||
-- @param MenuTime
|
||||
-- @return #nil
|
||||
function MENU_GROUP_COMMAND:Remove( MenuTime )
|
||||
self:F( { self.MenuGroupID, self.MenuPath, MenuTime, self.MenuTime } )
|
||||
--self:F2( { self.MenuGroupID, self.MenuPath, MenuTime, self.MenuTime } )
|
||||
|
||||
if not MenuTime or self.MenuTime ~= MenuTime then
|
||||
if self.MenuGroup._Menus[self.Path] then
|
||||
self = self.MenuGroup._Menus[self.Path]
|
||||
|
||||
missionCommands.removeItemForGroup( self.MenuGroupID, self.MenuPath )
|
||||
self:T( { "Removing Group Command Menu:", self.MenuGroup:GetName(), self.MenuText, self.Path, self.MenuGroup._Menus[self.Path].Path } )
|
||||
self:T( { "Removing Group Command Menu:", MenuGroup = self.MenuGroup:GetName(), MenuText = self.MenuText, MenuPath = self.Path } )
|
||||
|
||||
self.ParentMenu.Menus[self.MenuText] = nil
|
||||
self.ParentMenu.MenuCount = self.ParentMenu.MenuCount - 1
|
||||
|
||||
@ -261,13 +261,10 @@ end
|
||||
-- @param #TASK self
|
||||
-- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player aborting the Task.
|
||||
-- @return #boolean true if Unit is part of the Task.
|
||||
function TASK:AbortUnit( PlayerUnit )
|
||||
self:F( { PlayerUnit = PlayerUnit } )
|
||||
|
||||
local PlayerUnitAborted = false
|
||||
function TASK:AbortGroup( PlayerGroup )
|
||||
self:F( { PlayerGroup = PlayerGroup } )
|
||||
|
||||
local PlayerGroups = self:GetGroups()
|
||||
local PlayerGroup = PlayerUnit:GetGroup()
|
||||
|
||||
-- Is the PlayerGroup part of the PlayerGroups?
|
||||
if PlayerGroups:IsIncludeObject( PlayerGroup ) then
|
||||
@ -278,7 +275,7 @@ function TASK:AbortUnit( PlayerUnit )
|
||||
local IsGroupAssigned = self:IsGroupAssigned( PlayerGroup )
|
||||
self:E( { IsGroupAssigned = IsGroupAssigned } )
|
||||
if IsGroupAssigned then
|
||||
local PlayerName = PlayerUnit:GetPlayerName()
|
||||
local PlayerName = PlayerGroup:GetUnit(1):GetPlayerName()
|
||||
self:MessageToGroups( PlayerName .. " aborted Task " .. self:GetName() )
|
||||
self:UnAssignFromGroup( PlayerGroup )
|
||||
--self:Abort()
|
||||
@ -286,22 +283,24 @@ function TASK:AbortUnit( PlayerUnit )
|
||||
-- Now check if the task needs to go to hold...
|
||||
-- It will go to hold, if there are no players in the mission...
|
||||
|
||||
PlayerGroups:Flush()
|
||||
local IsRemaining = false
|
||||
for GroupName, AssignedGroup in pairs( PlayerGroups ) do
|
||||
IsRemaining = ( IsRemaining == false ) and self:IsGroupAssigned( AssignedGroup ) or IsRemaining
|
||||
for GroupName, AssignedGroup in pairs( PlayerGroups:GetSet() or {} ) do
|
||||
IsRemaining = ( ( IsRemaining == false ) and self:IsGroupAssigned( AssignedGroup ) ) or IsRemaining
|
||||
self:F( { Task = self:GetName(), IsRemaining = IsRemaining } )
|
||||
end
|
||||
|
||||
if IsRemaining == false then
|
||||
self:Abort()
|
||||
end
|
||||
|
||||
self:PlayerAborted( PlayerUnit )
|
||||
self:PlayerAborted( PlayerGroup:GetUnit(1) )
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
return PlayerUnitAborted
|
||||
return self
|
||||
end
|
||||
|
||||
--- A PlayerUnit crashed in a Task. Abort the Player.
|
||||
@ -369,7 +368,7 @@ do -- Group Assignment
|
||||
|
||||
local TaskGroupName = TaskGroup:GetName()
|
||||
|
||||
if self.AssignedGroups[TaskGroupName] == TaskGroup then
|
||||
if self.AssignedGroups[TaskGroupName] then
|
||||
self:T( { "Task is assigned to:", TaskGroup:GetName() } )
|
||||
return true
|
||||
end
|
||||
@ -808,10 +807,7 @@ end
|
||||
-- @param #TASK self
|
||||
function TASK:MenuTaskAbort( TaskGroup )
|
||||
|
||||
for PlayerUnitName, PlayerUnit in pairs( TaskGroup:GetUnits() ) do
|
||||
self:AbortUnit( PlayerUnit )
|
||||
end
|
||||
|
||||
self:AbortGroup( TaskGroup )
|
||||
end
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user