From 572d1f2902ea1cd009079d0f936a75805df57cfd Mon Sep 17 00:00:00 2001 From: FlightControl Date: Mon, 26 Jun 2017 20:35:28 +0200 Subject: [PATCH] Pre release --- Moose Mission Setup/Moose.lua | 104 ++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 43 deletions(-) diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index 8efb1f44e..106ddfc32 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170625_0742' ) +env.info( 'Moose Generation Timestamp: 20170626_2035' ) --- Various routines -- @module routines @@ -23762,6 +23762,8 @@ function SCORING:New( GameName ) -- Default penalty when a player changes coalition. self:SetCoalitionChangePenalty( self.ScaleDestroyPenalty ) + self:SetDisplayDisplayMessagePrefix( "Score: " ) + -- Event handlers self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash ) @@ -23776,15 +23778,23 @@ function SCORING:New( GameName ) end +--- Set a prefix string that will be displayed at each scoring message sent. +-- @param #SCORING self +-- @param #string DisplayMessagePrefix (Default="Scoring: ") The scoring prefix string. +-- @return #SCORING +function SCORING:SetDisplayDisplayMessagePrefix( DisplayMessagePrefix ) + self.DisplayDisplayMessagePrefix = DisplayDisplayMessagePrefix or "Scoring: " + return self +end + + --- Set the scale for scoring valid destroys (enemy destroys). -- A default calculated score is a value between 1 and 10. -- The scale magnifies the scores given to the players. -- @param #SCORING self -- @param #number Scale The scale of the score given. function SCORING:SetScaleDestroyScore( Scale ) - self.ScaleDestroyScore = Scale - return self end @@ -24087,7 +24097,7 @@ function SCORING:_AddPlayerFromUnit( UnitData ) if self.Players[PlayerName].UnitCoalition ~= UnitCoalition then self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + 50 self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1 - MESSAGE:New( "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] .. + MESSAGE:New( self.DisplayDisplayMessagePrefix .. "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] .. "(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.", 2 ):ToAll() @@ -24105,7 +24115,7 @@ function SCORING:_AddPlayerFromUnit( UnitData ) if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 then if self.Players[PlayerName].PenaltyWarning < 1 then - MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty, + MESSAGE:New( self.DisplayDisplayMessagePrefix .. "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty, 30 ):ToAll() self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1 @@ -24114,7 +24124,7 @@ function SCORING:_AddPlayerFromUnit( UnitData ) if self.Players[PlayerName].Penalty > self.Fratricide then --UnitData:Destroy() - MESSAGE:New( "Player '" .. PlayerName .. "' committed FRATRICIDE, he will be COURT MARTIALED and is DISMISSED from this mission!", + MESSAGE:New( self.DisplayDisplayMessagePrefix .. "Player '" .. PlayerName .. "' committed FRATRICIDE, he will be COURT MARTIALED and is DISMISSED from this mission!", 10 ):ToAll() end @@ -24147,7 +24157,7 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score ) PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score PlayerData.Score = PlayerData.Score + Score - MESSAGE:New( Text, 30 ):ToAll() + MESSAGE:New( self.DisplayDisplayMessagePrefix .. Text, 30 ):ToAll() self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() ) end @@ -24183,7 +24193,7 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score ) PlayerData.Score = self.Players[PlayerName].Score + Score PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score - MESSAGE:New( MissionName .. " : " .. Text .. " Score: " .. Score, 30 ):ToAll() + MESSAGE:New( self.DisplayDisplayMessagePrefix .. MissionName .. " : " .. Text .. " Score: " .. Score, 30 ):ToAll() self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() ) end @@ -24211,7 +24221,7 @@ function SCORING:_AddMissionScore( Mission, Text, Score ) PlayerData.Score = PlayerData.Score + Score PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score - MESSAGE:New( "Player '" .. PlayerName .. "' has " .. Text .. " in Mission '" .. MissionName .. "'. " .. + MESSAGE:New( self.DisplayDisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in Mission '" .. MissionName .. "'. " .. Score .. " mission score!", 60 ):ToAll() @@ -24381,7 +24391,7 @@ function SCORING:_EventOnHit( Event ) if TargetPlayerName ~= nil then -- It is a player hitting another player ... MESSAGE - :New( "Player '" .. InitPlayerName .. "' hit friendly player '" .. TargetPlayerName .. "' " .. + :New( self.DisplayDisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " .. "Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, 2 @@ -24390,7 +24400,7 @@ function SCORING:_EventOnHit( Event ) :ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() ) else MESSAGE - :New( "Player '" .. InitPlayerName .. "' hit a friendly target " .. + :New( self.DisplayDisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit a friendly target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " .. "Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, 2 @@ -24405,7 +24415,7 @@ function SCORING:_EventOnHit( Event ) PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1 if TargetPlayerName ~= nil then -- It is a player hitting another player ... MESSAGE - :New( "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. + :New( self.DisplayDisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " .. "Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty, 2 @@ -24414,7 +24424,7 @@ function SCORING:_EventOnHit( Event ) :ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() ) else MESSAGE - :New( "Player '" .. InitPlayerName .. "' hit an enemy target " .. + :New( self.DisplayDisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit an enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " .. "Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty, 2 @@ -24426,7 +24436,7 @@ function SCORING:_EventOnHit( Event ) end else -- A scenery object was hit. MESSAGE - :New( "Player '" .. InitPlayerName .. "' hit a scenery object.", + :New( self.DisplayDisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit a scenery object.", 2 ) :ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() ) @@ -24487,7 +24497,7 @@ function SCORING:_EventOnHit( Event ) PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 MESSAGE - :New( "Player '" .. Event.WeaponPlayerName .. "' hit a friendly target " .. + :New( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit a friendly target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " .. "Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, 2 @@ -24500,7 +24510,7 @@ function SCORING:_EventOnHit( Event ) PlayerHit.Score = PlayerHit.Score + 1 PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1 MESSAGE - :New( "Player '" .. Event.WeaponPlayerName .. "' hit an enemy target " .. + :New( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit an enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " .. "Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty, 2 @@ -24511,7 +24521,7 @@ function SCORING:_EventOnHit( Event ) end else -- A scenery object was hit. MESSAGE - :New( "Player '" .. Event.WeaponPlayerName .. "' hit a scenery object.", + :New( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit a scenery object.", 2 ) :ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() ) @@ -24610,7 +24620,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player MESSAGE - :New( "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. + :New( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. TargetDestroy.PenaltyDestroy .. " times. " .. "Penalty: -" .. TargetDestroy.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, 15 @@ -24619,7 +24629,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) :ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() ) else MESSAGE - :New( "Player '" .. PlayerName .. "' destroyed a friendly target " .. + :New( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed a friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. TargetDestroy.PenaltyDestroy .. " times. " .. "Penalty: -" .. TargetDestroy.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, 15 @@ -24644,7 +24654,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1 if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player MESSAGE - :New( "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. + :New( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. TargetDestroy.ScoreDestroy .. " times. " .. "Score: " .. TargetDestroy.Score .. ". Score Total:" .. Player.Score - Player.Penalty, 15 @@ -24653,7 +24663,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) :ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() ) else MESSAGE - :New( "Player '" .. PlayerName .. "' destroyed an enemy " .. + :New( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed an enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. TargetDestroy.ScoreDestroy .. " times. " .. "Score: " .. TargetDestroy.Score .. ". Total:" .. Player.Score - Player.Penalty, 15 @@ -24670,7 +24680,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) Player.Score = Player.Score + Score TargetDestroy.Score = TargetDestroy.Score + Score MESSAGE - :New( "Special target '" .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. " destroyed! " .. + :New( self.DisplayMessagePrefix .. "Special target '" .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. " destroyed! " .. "Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! Total: " .. Player.Score - Player.Penalty, 15 ) @@ -24689,7 +24699,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) Player.Score = Player.Score + Score TargetDestroy.Score = TargetDestroy.Score + Score MESSAGE - :New( "Target destroyed in zone '" .. ScoreZone:GetName() .. "'." .. + :New( self.DisplayMessagePrefix .. "Target destroyed in zone '" .. ScoreZone:GetName() .. "'." .. "Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! " .. "Total: " .. Player.Score - Player.Penalty, 15 ) @@ -24711,7 +24721,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) Player.Score = Player.Score + Score TargetDestroy.Score = TargetDestroy.Score + Score MESSAGE - :New( "Scenery destroyed in zone '" .. ScoreZone:GetName() .. "'." .. + :New( self.DisplayMessagePrefix .. "Scenery destroyed in zone '" .. ScoreZone:GetName() .. "'." .. "Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! " .. "Total: " .. Player.Score - Player.Penalty, 15 @@ -45229,10 +45239,9 @@ function MISSION:ReportBriefing() local Name = self:GetName() -- Determine the status of the mission. - local Status = self:GetState() - local TasksRemaining = self:GetTasksRemaining() + local Status = "<" .. self:GetState() .. ">" - Report:Add( "Mission " .. Name .. " - " .. Status .. " - Briefing Report." ) + Report:Add( string.format( '%s - %s - Mission Briefing Report', Name, Status ) ) Report:Add( self.MissionBriefing ) @@ -45263,8 +45272,7 @@ function MISSION:ReportStatus() local Name = self:GetName() -- Determine the status of the mission. - local Status = self:GetState() - local TasksRemaining = self:GetTasksRemaining() + local Status = "<" .. self:GetState() .. ">" Report:Add( string.format( '%s - Status "%s"', Name, Status ) ) @@ -45312,7 +45320,7 @@ function MISSION:ReportPlayersPerTask( ReportGroup ) local Name = self:GetName() -- Determine the status of the mission. - local Status = self:GetState() + local Status = "<" .. self:GetState() .. ">" Report:Add( string.format( '%s - %s - Players per Task Report', Name, Status ) ) @@ -45353,7 +45361,7 @@ function MISSION:ReportPlayersProgress( ReportGroup ) local Name = self:GetName() -- Determine the status of the mission. - local Status = self:GetState() + local Status = "<" .. self:GetState() .. ">" Report:Add( string.format( '%s - %s - Players per Task Progress Report', Name, Status ) ) @@ -45397,7 +45405,7 @@ function MISSION:ReportSummary() local Name = self:GetName() -- Determine the status of the mission. - local Status = self:GetState() + local Status = "<" .. self:GetState() .. ">" Report:Add( string.format( '%s - %s - Task Overview Report', Name, Status ) ) @@ -45421,7 +45429,7 @@ function MISSION:ReportOverview( ReportGroup, TaskStatus ) local Name = self:GetName() -- Determine the status of the mission. - local Status = self:GetState() + local Status = "<" .. self:GetState() .. ">" Report:Add( string.format( '%s - %s - %s Tasks Report', Name, Status, TaskStatus ) ) @@ -45448,7 +45456,7 @@ function MISSION:ReportDetails( ReportGroup ) local Name = self:GetName() -- Determine the status of the mission. - local Status = self:GetState() + local Status = "<" .. self:GetState() .. ">" Report:Add( string.format( '%s - %s - Task Detailed Report', Name, Status ) ) @@ -45473,6 +45481,9 @@ function MISSION:GetTasks() return self.Tasks end +--- Reports the briefing. +-- @param #MISSION self +-- @param Wrapper.Group#GROUP ReportGroup The group to which the report needs to be sent. function MISSION:MenuReportBriefing( ReportGroup ) local Report = self:ReportBriefing() @@ -45481,7 +45492,9 @@ function MISSION:MenuReportBriefing( ReportGroup ) end ---- @param #MISSION self + +--- Report the task summary. +-- @param #MISSION self -- @param Wrapper.Group#GROUP ReportGroup function MISSION:MenuReportTasksSummary( ReportGroup ) @@ -45490,6 +45503,9 @@ function MISSION:MenuReportTasksSummary( ReportGroup ) self:GetCommandCenter():MessageToGroup( Report, ReportGroup ) end + + + --- @param #MISSION self -- @param #string TaskStatus The status -- @param Wrapper.Group#GROUP ReportGroup @@ -46227,9 +46243,11 @@ end -- @return #TASK function TASK:SetMenuForGroup( TaskGroup, MenuTime ) - self:SetPlannedMenuForGroup( TaskGroup, MenuTime ) - if self:IsGroupAssigned( TaskGroup ) then - self:SetAssignedMenuForGroup( TaskGroup, MenuTime ) + if self:IsStatePlanned() or self:IsStateAssigned() then + self:SetPlannedMenuForGroup( TaskGroup, MenuTime ) + if self:IsGroupAssigned( TaskGroup ) then + self:SetAssignedMenuForGroup( TaskGroup, MenuTime ) + end end end @@ -46862,9 +46880,9 @@ function TASK:ReportSummary() --R2.1 fixed report. Now nicely formatted and cont local Name = self:GetName() -- Determine the status of the Task. - local State = self:GetState() + local Status = "<" .. self:GetState() .. ">" - Report:Add( "Task " .. Name .. " - State '" .. State ) + Report:Add( 'Task ' .. Name .. ' - State ' .. Status ) return Report:Text() end @@ -46881,7 +46899,7 @@ function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely form local Report = REPORT:New( Name ) -- Determine the status of the Task. - local State = self:GetState() + local Status = "<" .. self:GetState() .. ">" for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do @@ -46959,7 +46977,7 @@ function TASK:ReportDetails( ReportGroup ) local Name = self:GetName() -- Determine the status of the Task. - local State = self:GetState() + local Status = "<" .. self:GetState() .. ">" -- Loop each Unit active in the Task, and find Player Names. local PlayerNames = self:GetPlayerNames() @@ -46970,7 +46988,7 @@ function TASK:ReportDetails( ReportGroup ) end local Players = PlayerReport:Text() - Report:Add( "Task: " .. Name .. " - " .. State .. " - Detailed Report" ) + Report:Add( "Task: " .. Name .. " - " .. Status .. " - Detailed Report" ) Report:Add( " - Players:" ) Report:AddIndent( Players )