mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'refs/remotes/origin/master' into FlightControl-task-cargo-transport
# Conflicts: # Moose Development/Moose/Moose.lua # Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua # Moose Mission Setup/Moose.lua # Moose Test Missions/TAD - Task Dispatching/TAD-100 - A2G Task Dispatching DETECTION_AREAS/TAD-100 - A2G Task Dispatching DETECTION_AREAS.lua
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${system_path:luadocumentor.bat}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""Moose\Core\*.lua" "Moose\Wrapper\*.lua" "Moose\Actions\*.lua" "Moose\Functional\*.lua" "Moose\Tasking\*.lua" "Moose\Utilities\*.lua" "Moose\AI\*.lua" --dir "${workspace_loc:/Moose_Framework/docs/Documentation} --style ${workspace_loc:/Moose_Framework/docs/Stylesheet/stylesheet.css}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Moose_Framework/Moose Development}"/>
|
||||
</launchConfiguration>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="C:\Program Files\lua\5.1\bin\luadocumentor.bat"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""Moose\Core\*.lua" "Moose\Wrapper\*.lua" "Moose\Actions\*.lua" "Moose\Functional\*.lua" "Moose\Tasking\*.lua" "Moose\Utilities\*.lua" "Moose\AI\*.lua" --dir "${project_loc:}/docs/Documentation" --style "${project_loc:}/docs/Stylesheet/stylesheet.css""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Development"/>
|
||||
</launchConfiguration>
|
||||
@@ -3,7 +3,7 @@
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup\Moose_Create.bat"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""${project_loc:}/Moose Development" "${current_date}" "${project_loc:}/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT" "D""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${system_path:lua.exe}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""Moose_Create.lua" "D" "${current_date}" "${workspace_loc:/Moose_Framework//Moose Development/Moose}" "${workspace_loc:/Moose_Framework/Moose Mission Setup}""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Moose_Framework/Moose Mission Setup}"/>
|
||||
</launchConfiguration>
|
||||
@@ -3,7 +3,7 @@
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup\Moose_Create.bat"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""${project_loc:}/Moose Development/Moose" "${current_date}" "${project_loc:}/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT" "S""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${system_path:lua.exe}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""Moose_Create.lua" "S" "${current_date}" "${workspace_loc:/Moose_Framework//Moose Development/Moose}" "${workspace_loc:/Moose_Framework/Moose Mission Setup}""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Moose_Framework/Moose Mission Setup}"/>
|
||||
</launchConfiguration>
|
||||
@@ -3,7 +3,7 @@
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup/Moose Mission Update\Moose_Update_Missions.bat"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""${selected_resource_loc}""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup/Moose Mission Update"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Moose_Framework/Moose Mission Setup/Moose Mission Update/Moose_Update_Missions.bat}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""${workspace_loc:/Moose_Framework/Moose Test Missions}""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Moose_Framework/Moose Mission Setup/Moose Mission Update}"/>
|
||||
</launchConfiguration>
|
||||
@@ -3,7 +3,7 @@
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup/Moose Mission Update\Moose_Update_Missions.bat"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""${selected_resource_loc}""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup/Moose Mission Update"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Moose_Framework/Moose Mission Setup/Moose Mission Update/Moose_Update_Missions.bat}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="${selected_resource_loc}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Moose_Framework/Moose Mission Setup/Moose Mission Update}"/>
|
||||
</launchConfiguration>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup/Moose Mission Update\Moose_Update_Missions.bat"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""${project_loc:}/Moose Test Missions""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup/Moose Mission Update"/>
|
||||
</launchConfiguration>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup/Moose Mission Update\Moose_Update_Missions.bat"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""${resource_loc:}""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup/Moose Mission Update"/>
|
||||
</launchConfiguration>
|
||||
@@ -86,7 +86,6 @@
|
||||
|
||||
do -- FSM
|
||||
|
||||
--- FSM class
|
||||
--- @type FSM
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
@@ -1102,7 +1101,7 @@ do -- FSM_TASK
|
||||
--- FSM_TASK class
|
||||
-- @type FSM_TASK
|
||||
-- @field Tasking.Task#TASK Task
|
||||
-- @extends Core.Fsm#FSM
|
||||
-- @extends #FSM
|
||||
|
||||
--- # FSM_TASK, extends @{#FSM}
|
||||
--
|
||||
|
||||
@@ -1388,7 +1388,7 @@ do -- DETECTION_UNITS
|
||||
self:F()
|
||||
|
||||
local Report = REPORT:New( "Detected units:" )
|
||||
for DetectedItemID, DetectedItem in ipairs( self.DetectedItems ) do
|
||||
for DetectedItemID, DetectedItem in pairs( self.DetectedItems ) do
|
||||
local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem
|
||||
local ReportSummary = self:DetectedItemReportSummary( DetectedItemID )
|
||||
Report:Add( ReportSummary )
|
||||
|
||||
@@ -729,7 +729,8 @@ function SCORING:OnEventPlayerLeaveUnit( Event )
|
||||
if Event.IniUnit then
|
||||
local Menu = self:GetState( Event.IniUnit, "ScoringMenu" ) -- Core.Menu#MENU_GROUP
|
||||
if Menu then
|
||||
Menu:Remove()
|
||||
-- TODO: Check if this fixes #281.
|
||||
--Menu:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
--- This module contains the TASK class.
|
||||
--- **Tasking** -- This module contains the TASK class.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Authors: FlightControl - Design and Programming
|
||||
--
|
||||
-- @module Task
|
||||
|
||||
--- @type TASK
|
||||
-- @field Core.Scheduler#SCHEDULER TaskScheduler
|
||||
-- @field Tasking.Mission#MISSION Mission
|
||||
-- @field Core.Set#SET_GROUP SetGroup The Set of Groups assigned to the Task
|
||||
-- @field Core.Fsm#FSM_PROCESS FsmTemplate
|
||||
-- @field Tasking.Mission#MISSION Mission
|
||||
-- @field Tasking.CommandCenter#COMMANDCENTER CommandCenter
|
||||
-- @extends Core.Fsm#FSM_TASK
|
||||
|
||||
---
|
||||
-- # TASK class, extends @{Base#BASE}
|
||||
--
|
||||
-- ## The TASK class implements the methods for task orchestration within MOOSE.
|
||||
--
|
||||
-- 1) @{#TASK} class, extends @{Base#BASE}
|
||||
-- ============================================
|
||||
-- 1.1) The @{#TASK} class implements the methods for task orchestration within MOOSE.
|
||||
-- ----------------------------------------------------------------------------------------
|
||||
-- The class provides a couple of methods to:
|
||||
--
|
||||
-- * @{#TASK.AssignToGroup}():Assign a task to a group (of players).
|
||||
@@ -16,8 +35,8 @@
|
||||
-- * @{#TASK.UnAssignFromUnit}(): Unassign the task from a unit.
|
||||
-- * @{#TASK.SetTimeOut}(): Set timer in seconds before task gets cancelled if not assigned.
|
||||
--
|
||||
-- 1.2) Set and enquire task status (beyond the task state machine processing).
|
||||
-- ----------------------------------------------------------------------------
|
||||
-- ## 1.2) Set and enquire task status (beyond the task state machine processing).
|
||||
--
|
||||
-- A task needs to implement as a minimum the following task states:
|
||||
--
|
||||
-- * **Success**: Expresses the successful execution and finalization of the task.
|
||||
@@ -35,30 +54,17 @@
|
||||
-- The status of tasks can be set by the methods **State** followed by the task status. An example is `StateAssigned()`.
|
||||
-- The status of tasks can be enquired by the methods **IsState** followed by the task status name. An example is `if IsStateAssigned() then`.
|
||||
--
|
||||
-- 1.3) Add scoring when reaching a certain task status:
|
||||
-- -----------------------------------------------------
|
||||
-- ## 1.3) Add scoring when reaching a certain task status:
|
||||
--
|
||||
-- Upon reaching a certain task status in a task, additional scoring can be given. If the Mission has a scoring system attached, the scores will be added to the mission scoring.
|
||||
-- Use the method @{#TASK.AddScore}() to add scores when a status is reached.
|
||||
--
|
||||
-- 1.4) Task briefing:
|
||||
-- -------------------
|
||||
-- ## 1.4) Task briefing:
|
||||
--
|
||||
-- A task briefing can be given that is shown to the player when he is assigned to the task.
|
||||
--
|
||||
-- ===
|
||||
-- @field #TASK TASK
|
||||
--
|
||||
-- ### Authors: FlightControl - Design and Programming
|
||||
--
|
||||
-- @module Task
|
||||
|
||||
--- The TASK class
|
||||
-- @type TASK
|
||||
-- @field Core.Scheduler#SCHEDULER TaskScheduler
|
||||
-- @field Tasking.Mission#MISSION Mission
|
||||
-- @field Core.Set#SET_GROUP SetGroup The Set of Groups assigned to the Task
|
||||
-- @field Core.Fsm#FSM_PROCESS FsmTemplate
|
||||
-- @field Tasking.Mission#MISSION Mission
|
||||
-- @field Tasking.CommandCenter#COMMANDCENTER CommandCenter
|
||||
-- @extends Core.Fsm#FSM_TASK
|
||||
TASK = {
|
||||
ClassName = "TASK",
|
||||
TaskScheduler = nil,
|
||||
|
||||
@@ -368,10 +368,7 @@ do -- TASK_SEAD
|
||||
-- @param Tasking.Mission#MISSION Mission
|
||||
-- @param Set#SET_GROUP SetGroup The set of groups for which the Task can be assigned.
|
||||
-- @param #string TaskName The name of the Task.
|
||||
-- @param Set#SET_UNIT UnitSetTargets
|
||||
-- @param #number TargetDistance The distance to Target when the Player is considered to have "arrived" at the engagement range.
|
||||
-- @param Core.Zone#ZONE_BASE TargetZone The target zone, if known.
|
||||
-- If the TargetZone parameter is specified, the player will be routed to the center of the zone where all the targets are assumed to be.
|
||||
-- @param Set#SET_UNIT TargetSetUnit
|
||||
-- @return #TASK_SEAD self
|
||||
function TASK_SEAD:New( Mission, SetGroup, TaskName, TargetSetUnit )
|
||||
local self = BASE:Inherit( self, TASK_A2G:New( Mission, SetGroup, TaskName, TargetSetUnit, "SEAD" ) ) -- #TASK_SEAD
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
--- Provides a logging of statistics in a running DCS Mission.
|
||||
-- @script eStatHandler
|
||||
|
||||
|
||||
|
||||
|
||||
--Handler table
|
||||
local eStatHandler = {}
|
||||
local _StatRunID
|
||||
|
||||
--Neccessary tables for string instead of integers
|
||||
SETCoalition =
|
||||
{
|
||||
[1] = "red",
|
||||
[2] = "blue",
|
||||
}
|
||||
|
||||
SETGroupCat =
|
||||
{
|
||||
[1] = "AIRPLANE",
|
||||
[2] = "HELICOPTER",
|
||||
[3] = "GROUND",
|
||||
[4] = "SHIP",
|
||||
[5] = "STRUCTURE",
|
||||
}
|
||||
|
||||
SETWeaponCatName =
|
||||
{
|
||||
[0] = "SHELL",
|
||||
[1] = "MISSILE",
|
||||
[2] = "ROCKET",
|
||||
[3] = "BOMB",
|
||||
}
|
||||
|
||||
wEvent = {
|
||||
"S_EVENT_SHOT",
|
||||
"S_EVENT_HIT",
|
||||
"S_EVENT_TAKEOFF",
|
||||
"S_EVENT_LAND",
|
||||
"S_EVENT_CRASH",
|
||||
"S_EVENT_EJECTION",
|
||||
"S_EVENT_REFUELING",
|
||||
"S_EVENT_DEAD",
|
||||
"S_EVENT_PILOT_DEAD",
|
||||
"S_EVENT_BASE_CAPTURED",
|
||||
"S_EVENT_MISSION_START",
|
||||
"S_EVENT_MISSION_END",
|
||||
"S_EVENT_TOOK_CONTROL",
|
||||
"S_EVENT_REFUELING_STOP",
|
||||
"S_EVENT_BIRTH",
|
||||
"S_EVENT_HUMAN_FAILURE",
|
||||
"S_EVENT_ENGINE_STARTUP",
|
||||
"S_EVENT_ENGINE_SHUTDOWN",
|
||||
"S_EVENT_PLAYER_ENTER_UNIT",
|
||||
"S_EVENT_PLAYER_LEAVE_UNIT",
|
||||
"S_EVENT_PLAYER_COMMENT",
|
||||
"S_EVENT_SHOOTING_START",
|
||||
"S_EVENT_SHOOTING_END",
|
||||
"S_EVENT_MAX",
|
||||
}
|
||||
|
||||
statEventsTable = {}
|
||||
|
||||
|
||||
function SecondsToClock(sSeconds)
|
||||
local nSeconds = sSeconds
|
||||
if nSeconds == 0 then
|
||||
--return nil;
|
||||
return "00:00:00";
|
||||
else
|
||||
nHours = string.format("%02.f", math.floor(nSeconds/3600));
|
||||
nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60)));
|
||||
nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60));
|
||||
return nHours..":"..nMins..":"..nSecs
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function eStatHandler:onEvent(e)
|
||||
local InitID_ = ""
|
||||
local InitName = ""
|
||||
local WorldEvent = wEvent[e.id]
|
||||
local InitCoa = ""
|
||||
local InitGroupCat = ""
|
||||
local InitType = ""
|
||||
local InitPlayer = ""
|
||||
local eWeaponCat = ""
|
||||
local eWeaponName = ""
|
||||
local TargID_ = ""
|
||||
local TargName = ""
|
||||
local TargType = ""
|
||||
local TargPlayer = ""
|
||||
local TargCoa = ""
|
||||
local TargGroupCat = ""
|
||||
|
||||
if e.initiator and Object.getCategory(e.initiator) == Object.Category.UNIT then
|
||||
--Initiator variables
|
||||
local InitGroup = e.initiator:getGroup()
|
||||
InitID_ = e.initiator.id_
|
||||
if e.initiator:getName() then
|
||||
InitName = e.initiator:getName()
|
||||
end
|
||||
if InitGroup:getCoalition() then
|
||||
InitCoa = SETCoalition[InitGroup:getCoalition()]
|
||||
end
|
||||
if InitGroup:getCategory() then
|
||||
InitGroupCat = SETGroupCat[InitGroup:getCategory() + 1]
|
||||
end
|
||||
InitType = e.initiator:getTypeName()
|
||||
|
||||
--Get initiator player name or AI if NIL
|
||||
if e.initiator:getPlayerName() == nil then
|
||||
InitPlayer = "AI"
|
||||
else
|
||||
InitPlayer = e.initiator:getPlayerName()
|
||||
end
|
||||
else
|
||||
if e.initiator then
|
||||
local InitGroup = e.initiator:getGroup()
|
||||
InitID_ = e.initiator.id_
|
||||
if e.initiator:getName() then
|
||||
InitName = e.initiator:getName()
|
||||
end
|
||||
InitCoa = SETCoalition[InitGroup:getCoalition()]
|
||||
InitGroupCat = SETGroupCat[InitGroup:getCategory() + 1]
|
||||
InitType = e.initiator:getTypeName()
|
||||
|
||||
--Get initiator player name or AI if NIL
|
||||
if e.initiator:getPlayerName() == nil then
|
||||
InitPlayer = "AI"
|
||||
else
|
||||
InitPlayer = e.initiator:getPlayerName()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Weapon variables
|
||||
if e.weapon == nil then
|
||||
eWeaponCat = ""
|
||||
eWeaponName = ""
|
||||
else
|
||||
local eWeaponDesc = e.weapon:getDesc()
|
||||
eWeaponCat = SETWeaponCatName[eWeaponDesc.category]
|
||||
eWeaponName = eWeaponDesc.displayName
|
||||
end
|
||||
|
||||
--Target variables
|
||||
if e.target == nil then
|
||||
TargID_ = ""
|
||||
TargName = ""
|
||||
TargType = ""
|
||||
TargPlayer = ""
|
||||
TargCoa = ""
|
||||
TargGroupCat = ""
|
||||
elseif Object.getCategory(e.target) == Object.Category.UNIT then
|
||||
local TargGroup = e.target:getGroup()
|
||||
TargID_ = e.target.id_
|
||||
if e.target:getName() then
|
||||
TargName = e.target:getName()
|
||||
end
|
||||
TargType = e.target:getTypeName()
|
||||
TargCoa = SETCoalition[TargGroup:getCoalition()]
|
||||
TargGroupCat = SETGroupCat[TargGroup:getCategory() + 1]
|
||||
|
||||
--Get target player name or AI if NIL
|
||||
if not e.target:getPlayerName() then
|
||||
TargPlayer = "AI"
|
||||
else
|
||||
TargPlayer = e.target:getPlayerName()
|
||||
end
|
||||
else
|
||||
TargType = e.target:getTypeName()
|
||||
TargID_ = ""
|
||||
TargName = ""
|
||||
TargPlayer = ""
|
||||
TargCoa = ""
|
||||
TargGroupCat = ""
|
||||
end
|
||||
|
||||
--write events to table
|
||||
statEventsTable[#statEventsTable + 1] =
|
||||
{
|
||||
[1] = _StatRunID,
|
||||
[2] = SecondsToClock(timer.getTime()),
|
||||
[3] = WorldEvent,
|
||||
[4] = InitID_,
|
||||
[5] = InitName,
|
||||
[6] = InitCoa,
|
||||
[7] = InitGroupCat,
|
||||
[8] = InitType,
|
||||
[9] = InitPlayer,
|
||||
[10] = eWeaponCat,
|
||||
[11] = eWeaponName,
|
||||
[12] = TargID_,
|
||||
[13] = TargName,
|
||||
[14] = TargCoa,
|
||||
[15] = TargGroupCat,
|
||||
[16] = TargType,
|
||||
[17] = TargPlayer,
|
||||
}
|
||||
env.info( 'Event: ' .. _StatRunID .. '~ ' .. SecondsToClock(timer.getTime()) .. '~ ' .. WorldEvent .. '~ ' .. InitID_ .. '~ ' .. InitName .. '~ ' .. InitCoa .. '~ ' .. InitGroupCat .. '~ ' .. InitType .. '~ ' .. InitPlayer ..
|
||||
'~ ' .. eWeaponCat .. '~ ' .. eWeaponName .. '~ ' .. TargID_ .. '~ ' .. TargName .. '~ ' .. TargCoa .. '~ ' .. TargGroupCat .. '~ ' .. TargType .. '~ ' .. TargPlayer )
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
do
|
||||
|
||||
local StatFile,err
|
||||
|
||||
|
||||
function StatOpen()
|
||||
local fdir = lfs.writedir() .. [[Logs\]] .. "Events_" .. os.date( "%Y-%m-%d_%H-%M-%S" ) .. ".csv"
|
||||
StatFile,err = io.open(fdir,"w+")
|
||||
if not StatFile then
|
||||
local errmsg = 'Error: No Logs folder found in the User\\Saved Games\\DCS\\Logs directory...' .. 'Save_stat . sample: C:\\Users\\youname\\Saved Games\\DCS\\Logs'
|
||||
trigger.action.outText(errmsg, 10)
|
||||
return print(err)
|
||||
end
|
||||
StatFile:write("RunID~Time~Event~Initiator ID~Initiator Name~Initiator Coalition~Initiator Group Category~Initiator Type~Initiator Player~Weapon Category~Weapon Name~Target ID~Target Name~Target Coalition~Target Group Category~Target Type~Target Player\n")
|
||||
|
||||
_StatRunID = os.date("%y-%m-%d_%H-%M-%S")
|
||||
routines.scheduleFunction( StatSave, { }, timer.getTime() + 1, 1)
|
||||
end
|
||||
|
||||
function StatSave()
|
||||
--write statistic information to file
|
||||
for Index, eDetails in ipairs(statEventsTable) do
|
||||
for eInfoName, eInfoData in ipairs(eDetails) do
|
||||
StatFile:write(eInfoData.."~")
|
||||
end
|
||||
StatFile:write("\n")
|
||||
end
|
||||
statEventsTable = {}
|
||||
end
|
||||
|
||||
function StatClose()
|
||||
StatFile:close()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
world.addEventHandler(eStatHandler)
|
||||
StatOpen()
|
||||
|
||||
@@ -549,14 +549,22 @@ end
|
||||
--- Returns true if some units of the group are within a @{Zone}.
|
||||
-- @param #GROUP self
|
||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||
-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
|
||||
-- @return #boolean Returns true if the Group is partially within the @{Zone#ZONE_BASE}
|
||||
function GROUP:IsPartlyInZone( Zone )
|
||||
self:F2( { self.GroupName, Zone } )
|
||||
|
||||
local PartlyInZone = false
|
||||
|
||||
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||
if Zone:IsVec3InZone( Unit:GetVec3() ) then
|
||||
return true
|
||||
PartlyInZone = true
|
||||
else
|
||||
-- So, if there were groups in the zone found, and suddenly one NOT in the zone,
|
||||
-- then the group is partialy in the zone :-)
|
||||
if PartlyInZone == true then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -566,7 +574,7 @@ end
|
||||
--- Returns true if none of the group units of the group are within a @{Zone}.
|
||||
-- @param #GROUP self
|
||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||
-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
|
||||
-- @return #boolean Returns true if the Group is not within the @{Zone#ZONE_BASE}
|
||||
function GROUP:IsNotInZone( Zone )
|
||||
self:F2( { self.GroupName, Zone } )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user