mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updates on goal logic
This commit is contained in:
parent
4c72496599
commit
bfb11b6f79
@ -968,18 +968,19 @@ function MISSION:ReportPlayersProgress( ReportGroup )
|
||||
-- Determine how many tasks are remaining.
|
||||
for TaskID, Task in pairs( self:GetTasks() ) do
|
||||
local Task = Task -- Tasking.Task#TASK
|
||||
local TaskGoalTotal = Task:GetGoalTotal() or 0
|
||||
local TaskName = Task:GetName()
|
||||
local Goal = Task:GetGoal()
|
||||
PlayerList[TaskName] = PlayerList[TaskName] or {}
|
||||
if TaskGoalTotal ~= 0 then
|
||||
local PlayerNames = self:GetPlayerNames()
|
||||
for PlayerName, PlayerData in pairs( PlayerNames ) do
|
||||
PlayerList[TaskName][PlayerName] = string.format( 'Player (%s): Task "%s": %d%%', PlayerName, TaskName, Task:GetPlayerProgress( PlayerName ) * 100 / TaskGoalTotal )
|
||||
if Goal then
|
||||
local TotalContributions = Goal:GetTotalContributions()
|
||||
local PlayerContributions = Goal:GetPlayerContributions()
|
||||
self:F( { TotalContributions = TotalContributions, PlayerContributions = PlayerContributions } )
|
||||
for PlayerName, PlayerContribution in pairs( PlayerContributions ) do
|
||||
PlayerList[TaskName][PlayerName] = string.format( 'Player (%s): Task "%s": %d%%', PlayerName, TaskName, PlayerContributions[PlayerName] * 100 / TotalContributions )
|
||||
end
|
||||
else
|
||||
PlayerList[TaskName]["_"] = string.format( 'Player (---): Task "%s": %d%%', TaskName, 0 )
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
for TaskName, TaskData in pairs( PlayerList ) do
|
||||
|
||||
@ -1709,6 +1709,23 @@ end
|
||||
|
||||
do -- Links
|
||||
|
||||
--- Set goal of a task
|
||||
-- @param #TASK self
|
||||
-- @param Core.Goal#GOAL Goal
|
||||
-- @return #TASK
|
||||
function TASK:SetGoal( Goal )
|
||||
self.Goal = Goal
|
||||
end
|
||||
|
||||
|
||||
--- Get goal of a task
|
||||
-- @param #TASK self
|
||||
-- @return Core.Goal#GOAL The Goal
|
||||
function TASK:GetGoal()
|
||||
return self.Goal
|
||||
end
|
||||
|
||||
|
||||
--- Set dispatcher of a task
|
||||
-- @param #TASK self
|
||||
-- @param Tasking.DetectionManager#DETECTION_MANAGER Dispatcher
|
||||
|
||||
@ -213,7 +213,7 @@ do -- TASK_CAPTURE_ZONE
|
||||
|
||||
self:UpdateTaskInfo( true )
|
||||
|
||||
self:SetGoalTotal( 1 )
|
||||
self:SetGoal( self.ZoneGoal.Goal )
|
||||
|
||||
return self
|
||||
end
|
||||
@ -232,7 +232,7 @@ do -- TASK_CAPTURE_ZONE
|
||||
self.TaskInfo:AddText( "Zone Coalition", self.ZoneGoal:GetCoalitionName(), 11, "MOD", Persist )
|
||||
local SetUnit = self.ZoneGoal.Zone:GetScannedSetUnit()
|
||||
local ThreatLevel, ThreatText = SetUnit:CalculateThreatLevelA2G()
|
||||
self.TaskInfo:AddThreat( ThreatText, ThreatLevel, 20, "MSOD", Persist )
|
||||
self.TaskInfo:AddThreat( ThreatText, ThreatLevel, 20, "MOD", Persist )
|
||||
end
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user