Event Handling improved

This commit is contained in:
FlightControl
2017-02-07 10:34:16 +01:00
parent e9a4429f7a
commit 154f729788
16 changed files with 432 additions and 64241 deletions
@@ -66,7 +66,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
self.Missions = {}
self:EventOnBirth(
self:HandleEvent( EVENTS.Birth,
--- @param #COMMANDCENTER self
--- @param Core.Event#EVENTDATA EventData
function( self, EventData )
@@ -94,7 +94,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- - Set the correct menu.
-- - Assign the PlayerUnit to the Task if required.
-- - Send a message to the other players in the group that this player has joined.
self:EventOnPlayerEnterUnit(
self:HandleEvent( EVENTS.PlayerEnterUnit,
--- @param #COMMANDCENTER self
-- @param Core.Event#EVENTDATA EventData
function( self, EventData )
@@ -111,7 +111,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- 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:EventOnPlayerLeaveUnit(
self:HandleEvent( EVENTS.PlayerLeaveUnit,
--- @param #TASK self
-- @param Core.Event#EVENTDATA EventData
function( self, EventData )
@@ -126,7 +126,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- 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:EventOnCrash(
self:HandleEvent( EVENTS.Crash,
--- @param #TASK self
-- @param Core.Event#EVENTDATA EventData
function( self, EventData )
-25
View File
@@ -181,31 +181,6 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType )
self.TaskBriefing = "You are invited for the task: " .. self.TaskName .. "."
self.FsmTemplate = self.FsmTemplate or FSM_PROCESS:New()
-- Handle the birth of new planes within the assigned set.
-- Handle when a player crashes ...
-- The Task is UnAssigned from the Unit.
-- When there is no Unit left running the Task, and all of the Players crashed, the Task goes into Failed ...
-- self:EventOnCrash(
-- --- @param #TASK self
-- -- @param Core.Event#EVENTDATA EventData
-- function( self, EventData )
-- self:E( "In LeaveUnit" )
-- self:E( { "State", self:GetState() } )
-- if self:IsStateAssigned() then
-- local TaskUnit = EventData.IniUnit
-- local TaskGroup = EventData.IniUnit:GetGroup()
-- self:E( self.SetGroup:IsIncludeObject( TaskGroup ) )
-- if self.SetGroup:IsIncludeObject( TaskGroup ) then
-- self:UnAssignFromUnit( TaskUnit )
-- end
-- self:MessageToGroups( TaskUnit:GetPlayerName() .. " crashed!, and has aborted Task " .. self:GetName() )
-- end
-- end
-- )
--
Mission:AddTask( self )