mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-23 19:45:29 +00:00
Various improvements
This commit is contained in:
@@ -142,6 +142,7 @@ do -- Goal
|
|||||||
-- @param #GOAL self
|
-- @param #GOAL self
|
||||||
-- @param #string PlayerName The name of the player.
|
-- @param #string PlayerName The name of the player.
|
||||||
function GOAL:AddPlayerContribution( PlayerName )
|
function GOAL:AddPlayerContribution( PlayerName )
|
||||||
|
self:F({PlayerName})
|
||||||
self.Players[PlayerName] = self.Players[PlayerName] or 0
|
self.Players[PlayerName] = self.Players[PlayerName] or 0
|
||||||
self.Players[PlayerName] = self.Players[PlayerName] + 1
|
self.Players[PlayerName] = self.Players[PlayerName] + 1
|
||||||
self.TotalContributions = self.TotalContributions + 1
|
self.TotalContributions = self.TotalContributions + 1
|
||||||
|
|||||||
@@ -710,7 +710,18 @@ function ZONE_RADIUS:GetScannedSetUnit()
|
|||||||
|
|
||||||
if self.ScanData then
|
if self.ScanData then
|
||||||
for ObjectID, UnitObject in pairs( self.ScanData.Units ) do
|
for ObjectID, UnitObject in pairs( self.ScanData.Units ) do
|
||||||
SetUnit:AddUnit( UNIT:FindByName(UnitObject:getName() ) )
|
local UnitObject = UnitObject -- DCS#Unit
|
||||||
|
if UnitObject:isExist() then
|
||||||
|
local FoundUnit = UNIT:FindByName( UnitObject:getName() )
|
||||||
|
if FoundUnit then
|
||||||
|
SetUnit:AddUnit( FoundUnit )
|
||||||
|
else
|
||||||
|
local FoundStatic = STATIC:FindByName( UnitObject:getName() )
|
||||||
|
if FoundStatic then
|
||||||
|
SetUnit:AddUnit( FoundStatic )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
|
|||||||
if EventGroup and self:HasGroup( EventGroup ) then
|
if EventGroup and self:HasGroup( EventGroup ) then
|
||||||
local CommandCenterMenu = MENU_GROUP:New( EventGroup, self:GetText() )
|
local CommandCenterMenu = MENU_GROUP:New( EventGroup, self:GetText() )
|
||||||
local MenuReporting = MENU_GROUP:New( EventGroup, "Missions Reports", CommandCenterMenu )
|
local MenuReporting = MENU_GROUP:New( EventGroup, "Missions Reports", CommandCenterMenu )
|
||||||
local MenuMissionsSummary = MENU_GROUP_COMMAND:New( EventGroup, "Missions Status Report", MenuReporting, self.ReportMissionsStatus, self, EventGroup )
|
local MenuMissionsSummary = MENU_GROUP_COMMAND:New( EventGroup, "Missions Status Report", MenuReporting, self.ReportSummary, self, EventGroup )
|
||||||
local MenuMissionsDetails = MENU_GROUP_COMMAND:New( EventGroup, "Missions Players Report", MenuReporting, self.ReportMissionsPlayers, self, EventGroup )
|
local MenuMissionsDetails = MENU_GROUP_COMMAND:New( EventGroup, "Missions Players Report", MenuReporting, self.ReportMissionsPlayers, self, EventGroup )
|
||||||
self:ReportSummary( EventGroup )
|
self:ReportSummary( EventGroup )
|
||||||
local PlayerUnit = EventData.IniUnit
|
local PlayerUnit = EventData.IniUnit
|
||||||
@@ -507,14 +507,18 @@ function COMMANDCENTER:AssignTask( TaskGroup )
|
|||||||
end
|
end
|
||||||
|
|
||||||
local Task = Tasks[ math.random( 1, #Tasks ) ] -- Tasking.Task#TASK
|
local Task = Tasks[ math.random( 1, #Tasks ) ] -- Tasking.Task#TASK
|
||||||
|
|
||||||
|
if Task then
|
||||||
|
|
||||||
self:I( "Assigning task " .. Task:GetName() .. " using auto assign method " .. self.AutoAssignMethod .. " to " .. TaskGroup:GetName() .. " with task priority " .. AssignPriority )
|
self:I( "Assigning task " .. Task:GetName() .. " using auto assign method " .. self.AutoAssignMethod .. " to " .. TaskGroup:GetName() .. " with task priority " .. AssignPriority )
|
||||||
|
|
||||||
if not self.AutoAcceptTasks == true then
|
if not self.AutoAcceptTasks == true then
|
||||||
Task:SetAutoAssignMethod( ACT_ASSIGN_MENU_ACCEPT:New( Task.TaskBriefing ) )
|
Task:SetAutoAssignMethod( ACT_ASSIGN_MENU_ACCEPT:New( Task.TaskBriefing ) )
|
||||||
|
end
|
||||||
|
|
||||||
|
Task:AssignToGroup( TaskGroup )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Task:AssignToGroup( TaskGroup )
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1808,7 +1808,7 @@ function TASK:GetPlayerNames() --R2.1 Get a map of the players.
|
|||||||
if PlayerGroup:IsAlive() == true then
|
if PlayerGroup:IsAlive() == true then
|
||||||
if self:IsGroupAssigned( PlayerGroup ) then
|
if self:IsGroupAssigned( PlayerGroup ) then
|
||||||
local PlayerNames = PlayerGroup:GetPlayerNames()
|
local PlayerNames = PlayerGroup:GetPlayerNames()
|
||||||
for PlayerNameID, PlayerName in pairs( PlayerNames ) do
|
for PlayerNameID, PlayerName in pairs( PlayerNames or {} ) do
|
||||||
PlayerNameMap[PlayerName] = PlayerGroup
|
PlayerNameMap[PlayerName] = PlayerGroup
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ do -- TASK_CAPTURE_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CaptureZone.Task.OnEnterSuccess( Task, From, Event, To )
|
function CaptureZone.Task.OnEnterSuccess( Task, From, Event, To )
|
||||||
self:Success( Task )
|
--self:Success( Task )
|
||||||
if self.AI_A2G_Dispatcher then
|
if self.AI_A2G_Dispatcher then
|
||||||
self.AI_A2G_Dispatcher:Lock( Task.TaskZoneName ) -- This will lock the zone from being defended by AI.
|
self.AI_A2G_Dispatcher:Lock( Task.TaskZoneName ) -- This will lock the zone from being defended by AI.
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -211,7 +211,9 @@ do -- TASK_CAPTURE_ZONE
|
|||||||
"Capture Zone " .. self.TaskZoneName
|
"Capture Zone " .. self.TaskZoneName
|
||||||
)
|
)
|
||||||
|
|
||||||
self:UpdateTaskInfo()
|
self:UpdateTaskInfo( true )
|
||||||
|
|
||||||
|
self:SetGoalTotal( 1 )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -219,18 +221,18 @@ do -- TASK_CAPTURE_ZONE
|
|||||||
|
|
||||||
--- Instantiates a new TASK_CAPTURE_ZONE.
|
--- Instantiates a new TASK_CAPTURE_ZONE.
|
||||||
-- @param #TASK_CAPTURE_ZONE self
|
-- @param #TASK_CAPTURE_ZONE self
|
||||||
function TASK_CAPTURE_ZONE:UpdateTaskInfo( DetectedItem )
|
function TASK_CAPTURE_ZONE:UpdateTaskInfo( Persist )
|
||||||
|
|
||||||
self:F({"Update"})
|
Persist = Persist or false
|
||||||
|
|
||||||
local ZoneCoordinate = self.ZoneGoal:GetZone():GetCoordinate()
|
local ZoneCoordinate = self.ZoneGoal:GetZone():GetCoordinate()
|
||||||
self.TaskInfo:AddTaskName( 0, "MSOD" )
|
self.TaskInfo:AddTaskName( 0, "MSOD", Persist )
|
||||||
self.TaskInfo:AddCoordinate( ZoneCoordinate, 1, "SOD" )
|
self.TaskInfo:AddCoordinate( ZoneCoordinate, 1, "SOD", Persist )
|
||||||
self.TaskInfo:AddText( "Zone Name", self.ZoneGoal:GetZoneName(), 10, "MOD" )
|
self.TaskInfo:AddText( "Zone Name", self.ZoneGoal:GetZoneName(), 10, "MOD", Persist )
|
||||||
self.TaskInfo:AddText( "Zone Coalition", self.ZoneGoal:GetCoalitionName(), 11, "MOD" )
|
self.TaskInfo:AddText( "Zone Coalition", self.ZoneGoal:GetCoalitionName(), 11, "MOD", Persist )
|
||||||
local SetUnit = self.ZoneGoal.Zone:GetScannedSetUnit()
|
local SetUnit = self.ZoneGoal.Zone:GetScannedSetUnit()
|
||||||
local ThreatLevel, ThreatText = SetUnit:CalculateThreatLevelA2G()
|
local ThreatLevel, ThreatText = SetUnit:CalculateThreatLevelA2G()
|
||||||
self.TaskInfo:AddThreat( ThreatText, ThreatLevel, 20, "MOD" )
|
self.TaskInfo:AddThreat( ThreatText, ThreatLevel, 20, "MSOD", Persist )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -251,7 +253,6 @@ do -- TASK_CAPTURE_ZONE
|
|||||||
|
|
||||||
if self.ZoneGoal then
|
if self.ZoneGoal then
|
||||||
if self.ZoneGoal.Goal:IsAchieved() then
|
if self.ZoneGoal.Goal:IsAchieved() then
|
||||||
self:Success()
|
|
||||||
local TotalContributions = self.ZoneGoal.Goal:GetTotalContributions()
|
local TotalContributions = self.ZoneGoal.Goal:GetTotalContributions()
|
||||||
local PlayerContributions = self.ZoneGoal.Goal:GetPlayerContributions()
|
local PlayerContributions = self.ZoneGoal.Goal:GetPlayerContributions()
|
||||||
self:F( { TotalContributions = TotalContributions, PlayerContributions = PlayerContributions } )
|
self:F( { TotalContributions = TotalContributions, PlayerContributions = PlayerContributions } )
|
||||||
@@ -261,6 +262,7 @@ do -- TASK_CAPTURE_ZONE
|
|||||||
Scoring:_AddMissionGoalScore( self.Mission, PlayerName, "Zone " .. self.ZoneGoal:GetZoneName() .." captured", PlayerContribution * 200 / TotalContributions )
|
Scoring:_AddMissionGoalScore( self.Mission, PlayerName, "Zone " .. self.ZoneGoal:GetZoneName() .." captured", PlayerContribution * 200 / TotalContributions )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
self:Success()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1479,3 +1479,33 @@ function POSITIONABLE:SmokeBlue()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Returns true if the unit is within a @{Zone}.
|
||||||
|
-- @param #STPOSITIONABLEATIC self
|
||||||
|
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||||
|
-- @return #boolean Returns true if the unit is within the @{Core.Zone#ZONE_BASE}
|
||||||
|
function POSITIONABLE:IsInZone( Zone )
|
||||||
|
self:F2( { self.PositionableName, Zone } )
|
||||||
|
|
||||||
|
if self:IsAlive() then
|
||||||
|
local IsInZone = Zone:IsVec3InZone( self:GetVec3() )
|
||||||
|
|
||||||
|
return IsInZone
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Returns true if the unit is not within a @{Zone}.
|
||||||
|
-- @param #POSITIONABLE self
|
||||||
|
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||||
|
-- @return #boolean Returns true if the unit is not within the @{Core.Zone#ZONE_BASE}
|
||||||
|
function POSITIONABLE:IsNotInZone( Zone )
|
||||||
|
self:F2( { self.PositionableName, Zone } )
|
||||||
|
|
||||||
|
if self:IsAlive() then
|
||||||
|
local IsNotInZone = not Zone:IsVec3InZone( self:GetVec3() )
|
||||||
|
|
||||||
|
return IsNotInZone
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -214,35 +214,3 @@ function STATIC:ReSpawnAt( Coordinate, Heading )
|
|||||||
SpawnStatic:ReSpawnAt( Coordinate, Heading )
|
SpawnStatic:ReSpawnAt( Coordinate, Heading )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Returns true if the unit is within a @{Zone}.
|
|
||||||
-- @param #STATIC self
|
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
|
||||||
-- @return #boolean Returns true if the unit is within the @{Core.Zone#ZONE_BASE}
|
|
||||||
function STATIC:IsInZone( Zone )
|
|
||||||
self:F2( { self.StaticName, Zone } )
|
|
||||||
|
|
||||||
if self:IsAlive() then
|
|
||||||
local IsInZone = Zone:IsVec3InZone( self:GetVec3() )
|
|
||||||
|
|
||||||
return IsInZone
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Returns true if the unit is not within a @{Zone}.
|
|
||||||
-- @param #STATIC self
|
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
|
||||||
-- @return #boolean Returns true if the unit is not within the @{Core.Zone#ZONE_BASE}
|
|
||||||
function STATIC:IsNotInZone( Zone )
|
|
||||||
self:F2( { self.StaticName, Zone } )
|
|
||||||
|
|
||||||
if self:IsAlive() then
|
|
||||||
local IsInZone = not Zone:IsVec3InZone( self:GetVec3() )
|
|
||||||
|
|
||||||
self:T( { IsInZone } )
|
|
||||||
return IsInZone
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ end
|
|||||||
-- @return #string Player Name
|
-- @return #string Player Name
|
||||||
-- @return #nil The DCS Unit is not existing or alive.
|
-- @return #nil The DCS Unit is not existing or alive.
|
||||||
function UNIT:GetPlayerName()
|
function UNIT:GetPlayerName()
|
||||||
self:F2( self.UnitName )
|
self:F( self.UnitName )
|
||||||
|
|
||||||
local DCSUnit = self:GetDCSObject() -- DCS#Unit
|
local DCSUnit = self:GetDCSObject() -- DCS#Unit
|
||||||
|
|
||||||
@@ -831,37 +831,6 @@ end
|
|||||||
|
|
||||||
-- Is functions
|
-- Is functions
|
||||||
|
|
||||||
--- Returns true if the unit is within a @{Zone}.
|
|
||||||
-- @param #UNIT self
|
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
|
||||||
-- @return #boolean Returns true if the unit is within the @{Core.Zone#ZONE_BASE}
|
|
||||||
function UNIT:IsInZone( Zone )
|
|
||||||
self:F2( { self.UnitName, Zone } )
|
|
||||||
|
|
||||||
if self:IsAlive() then
|
|
||||||
local IsInZone = Zone:IsVec3InZone( self:GetVec3() )
|
|
||||||
|
|
||||||
return IsInZone
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Returns true if the unit is not within a @{Zone}.
|
|
||||||
-- @param #UNIT self
|
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
|
||||||
-- @return #boolean Returns true if the unit is not within the @{Core.Zone#ZONE_BASE}
|
|
||||||
function UNIT:IsNotInZone( Zone )
|
|
||||||
self:F2( { self.UnitName, Zone } )
|
|
||||||
|
|
||||||
if self:IsAlive() then
|
|
||||||
local IsInZone = not Zone:IsVec3InZone( self:GetVec3() )
|
|
||||||
|
|
||||||
self:T( { IsInZone } )
|
|
||||||
return IsInZone
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--- Returns true if there is an **other** DCS Unit within a radius of the current 2D point of the DCS Unit.
|
--- Returns true if there is an **other** DCS Unit within a radius of the current 2D point of the DCS Unit.
|
||||||
|
|||||||
Reference in New Issue
Block a user