mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
debug
This commit is contained in:
16
CTLD.lua
16
CTLD.lua
@@ -7744,8 +7744,7 @@ end
|
|||||||
-- Make orbit the group "_grpName", on target "_unitTargetName". _alti in meters, speed in km/h
|
-- Make orbit the group "_grpName", on target "_unitTargetName". _alti in meters, speed in km/h
|
||||||
function ctld.StartOrbitGroup(_jtacUnitName, _unitTargetName, _alti, _speed)
|
function ctld.StartOrbitGroup(_jtacUnitName, _unitTargetName, _alti, _speed)
|
||||||
if (Unit.getByName(_unitTargetName) ~= nil) and (Unit.getByName(_jtacUnitName) ~= nil) then -- si target unit and JTAC group exist
|
if (Unit.getByName(_unitTargetName) ~= nil) and (Unit.getByName(_jtacUnitName) ~= nil) then -- si target unit and JTAC group exist
|
||||||
local orbit = {
|
local orbit = { id = 'Orbit',
|
||||||
id = 'Orbit',
|
|
||||||
params = {pattern = 'Circle',
|
params = {pattern = 'Circle',
|
||||||
point = mist.utils.makeVec2(mist.getAvgPos(mist.makeUnitTable({_unitTargetName}))),
|
point = mist.utils.makeVec2(mist.getAvgPos(mist.makeUnitTable({_unitTargetName}))),
|
||||||
speed = _speed,
|
speed = _speed,
|
||||||
@@ -7794,7 +7793,7 @@ end
|
|||||||
-- Modify the route deleting all the WP before "firstWP" param, for aligne the orbit on the nearest WP of the target
|
-- Modify the route deleting all the WP before "firstWP" param, for aligne the orbit on the nearest WP of the target
|
||||||
function ctld.backToRoute(_jtacUnitName)
|
function ctld.backToRoute(_jtacUnitName)
|
||||||
local jtacGroupName = Unit.getByName(_jtacUnitName):getGroup():getName()
|
local jtacGroupName = Unit.getByName(_jtacUnitName):getGroup():getName()
|
||||||
local JTACRoute = mist.getGroupRoute (jtacGroupName, true) -- get the initial editor route of the current group
|
local JTACRoute = mist.getGroupRoute(jtacGroupName, true) -- get the initial editor route of the current group
|
||||||
local newJTACRoute = ctld.adjustRoute(JTACRoute, ctld.getNearestWP(_jtacUnitName))
|
local newJTACRoute = ctld.adjustRoute(JTACRoute, ctld.getNearestWP(_jtacUnitName))
|
||||||
local Mission = {}
|
local Mission = {}
|
||||||
Mission = { id = 'Mission', params = {route = {points = newJTACRoute}}}
|
Mission = { id = 'Mission', params = {route = {points = newJTACRoute}}}
|
||||||
@@ -7803,7 +7802,6 @@ function ctld.backToRoute(_jtacUnitName)
|
|||||||
if ctld.InOrbitList(_jtacUnitName) == true then -- if JTAC orbiting => stop it
|
if ctld.InOrbitList(_jtacUnitName) == true then -- if JTAC orbiting => stop it
|
||||||
ctld.OrbitInUse[_jtacUnitName] = nil
|
ctld.OrbitInUse[_jtacUnitName] = nil
|
||||||
end
|
end
|
||||||
--Unit.getByName(_jtacUnitName):getController():popTask() -- stop current Task
|
|
||||||
Unit.getByName(_jtacUnitName):getController():setTask(Mission) -- submit the new route
|
Unit.getByName(_jtacUnitName):getController():setTask(Mission) -- submit the new route
|
||||||
return Mission
|
return Mission
|
||||||
end
|
end
|
||||||
@@ -7832,14 +7830,12 @@ function ctld.adjustRoute(_initialRouteTable, _firstWpOfNewRoute) -- create a r
|
|||||||
for j=1, #adjustedRoute[idx].task.params.tasks do
|
for j=1, #adjustedRoute[idx].task.params.tasks do
|
||||||
if adjustedRoute[idx].task.params.tasks[j].id ~= "ControlledTask" then
|
if adjustedRoute[idx].task.params.tasks[j].id ~= "ControlledTask" then
|
||||||
if adjustedRoute[idx].task.params.tasks[j].params.action.id == "SwitchWaypoint" then
|
if adjustedRoute[idx].task.params.tasks[j].params.action.id == "SwitchWaypoint" then
|
||||||
local fromWaypointIndex = adjustedRoute[idx].task.params.tasks[j].params.action.params.fromWaypointIndex
|
|
||||||
local goToWaypointIndex = adjustedRoute[idx].task.params.tasks[j].params.action.params.goToWaypointIndex
|
local goToWaypointIndex = adjustedRoute[idx].task.params.tasks[j].params.action.params.goToWaypointIndex
|
||||||
adjustedRoute[idx].task.params.tasks[j].params.action.params.fromWaypointIndex = idx
|
adjustedRoute[idx].task.params.tasks[j].params.action.params.fromWaypointIndex = idx
|
||||||
adjustedRoute[idx].task.params.tasks[j].params.action.params.goToWaypointIndex = mappingWP[goToWaypointIndex]
|
adjustedRoute[idx].task.params.tasks[j].params.action.params.goToWaypointIndex = mappingWP[goToWaypointIndex]
|
||||||
end
|
end
|
||||||
else -- for "ControlledTask"
|
else -- for "ControlledTask"
|
||||||
if adjustedRoute[idx].task.params.tasks[j].params.task.params.action.id == "SwitchWaypoint" then
|
if adjustedRoute[idx].task.params.tasks[j].params.task.params.action.id == "SwitchWaypoint" then
|
||||||
local fromWaypointIndex = adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.fromWaypointIndex
|
|
||||||
local goToWaypointIndex = adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.goToWaypointIndex
|
local goToWaypointIndex = adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.goToWaypointIndex
|
||||||
adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.fromWaypointIndex = idx
|
adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.fromWaypointIndex = idx
|
||||||
adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.goToWaypointIndex = mappingWP[goToWaypointIndex]
|
adjustedRoute[idx].task.params.tasks[j].params.task.params.action.params.goToWaypointIndex = mappingWP[goToWaypointIndex]
|
||||||
@@ -7847,10 +7843,7 @@ function ctld.adjustRoute(_initialRouteTable, _firstWpOfNewRoute) -- create a r
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--[[
|
||||||
local newTaskIdx = #adjustedRoute[#adjustedRoute].task.params.tasks + 1
|
|
||||||
|
|
||||||
--[[
|
|
||||||
[14]["task"]["params"]["tasks"][1] = table: 0000012EF5AF0CA8 {
|
[14]["task"]["params"]["tasks"][1] = table: 0000012EF5AF0CA8 {
|
||||||
[14]["task"]["params"]["tasks"][1]["number"] = 1,
|
[14]["task"]["params"]["tasks"][1]["number"] = 1,
|
||||||
[14]["task"]["params"]["tasks"][1]["auto"] = false,
|
[14]["task"]["params"]["tasks"][1]["auto"] = false,
|
||||||
@@ -7864,6 +7857,7 @@ function ctld.adjustRoute(_initialRouteTable, _firstWpOfNewRoute) -- create a r
|
|||||||
[14]["task"]["params"]["tasks"][1]["params"]["action"]["params"]["fromWaypointIndex"] = 14,
|
[14]["task"]["params"]["tasks"][1]["params"]["action"]["params"]["fromWaypointIndex"] = 14,
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
local newTaskIdx = #adjustedRoute[#adjustedRoute].task.params.tasks + 1
|
||||||
adjustedRoute[#adjustedRoute].task.params.tasks[newTaskIdx] = {number = newTaskIdx,
|
adjustedRoute[#adjustedRoute].task.params.tasks[newTaskIdx] = {number = newTaskIdx,
|
||||||
auto = false,
|
auto = false,
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@@ -7873,7 +7867,7 @@ function ctld.adjustRoute(_initialRouteTable, _firstWpOfNewRoute) -- create a r
|
|||||||
adjustedRoute[#adjustedRoute].task.params.tasks[newTaskIdx].params.action.id = "SwitchWaypoint"
|
adjustedRoute[#adjustedRoute].task.params.tasks[newTaskIdx].params.action.id = "SwitchWaypoint"
|
||||||
adjustedRoute[#adjustedRoute].task.params.tasks[newTaskIdx].params.action.params = {fromWaypointIndex = #_initialRouteTable,
|
adjustedRoute[#adjustedRoute].task.params.tasks[newTaskIdx].params.action.params = {fromWaypointIndex = #_initialRouteTable,
|
||||||
goToWaypointIndex = 1 }
|
goToWaypointIndex = 1 }
|
||||||
ctld.logDebug("ctld.adjustRoute - adjustedRoute = [%s]", ctld.p(adjustedRoute,100))
|
ctld.logDebug("ctld.adjustRoute - adjustedRoute = [%s]", ctld.p(adjustedRoute))
|
||||||
return adjustedRoute
|
return adjustedRoute
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user