Fixed tasks not being aborted when a player leaves the slot or disconnects.

This commit is contained in:
FlightControl_Master 2018-03-09 14:35:34 +01:00
parent 778ab58eee
commit 370278e643

View File

@ -155,22 +155,22 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
end
)
-- -- Handle when a player leaves a slot and goes back to spectators ...
-- -- The PlayerUnit will be UnAssigned from the Task.
-- -- When there is no Unit left running the Task, the Task goes into Abort...
-- self:HandleEvent( EVENTS.PlayerLeaveUnit,
-- --- @param #TASK self
-- -- @param Core.Event#EVENTDATA EventData
-- function( self, EventData )
-- local PlayerUnit = EventData.IniUnit
-- for MissionID, Mission in pairs( self:GetMissions() ) do
-- local Mission = Mission -- Tasking.Mission#MISSION
-- if Mission:IsENGAGED() then
-- Mission:AbortUnit( PlayerUnit )
-- end
-- end
-- end
-- )
-- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task.
-- When there is no Unit left running the Task, the Task goes into Abort...
self:HandleEvent( EVENTS.PlayerLeaveUnit,
--- @param #TASK self
-- @param Core.Event#EVENTDATA EventData
function( self, EventData )
local PlayerUnit = EventData.IniUnit
for MissionID, Mission in pairs( self:GetMissions() ) do
local Mission = Mission -- Tasking.Mission#MISSION
if Mission:IsENGAGED() then
Mission:AbortUnit( PlayerUnit )
end
end
end
)
-- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task.