mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2025-11-25 19:31:01 +00:00
Added "engage targets" wingman command
This commit is contained in:
parent
74cce4b048
commit
1fa8269427
@ -85,11 +85,11 @@ Library.radioMessages = {
|
||||
pilotWarningSAMLaunch = { "Spike! SAM just launched, break!", "SAM up! Defensive now!", "Launch! SAM, coming fast, pump chaff, go cold!", "SAM in the air, break hard!", "SAM fired, visual smoke! Extend, extend!" },
|
||||
|
||||
pilotWingmanEngageAir = {
|
||||
"$1, copy, engaging now.",
|
||||
"$1, tally one, pressing.",
|
||||
"$1, roger, comitting.",
|
||||
"$1, confirm, going after him.",
|
||||
"$1, affirm, moving in on bandits."
|
||||
"$1, copy, engaging $2 now.",
|
||||
"$1, tally one, pressing on $2.",
|
||||
"$1, roger, comitting on $2.",
|
||||
"$1, confirm, going after $2.",
|
||||
"$1, affirm, moving in on $2."
|
||||
},
|
||||
pilotWingmanEngageNoTarget = {
|
||||
"$1, negative tally, unable engage.",
|
||||
@ -99,11 +99,11 @@ Library.radioMessages = {
|
||||
"$1, that's a no, not seeing any targets."
|
||||
},
|
||||
pilotWingmanEngageSurface = {
|
||||
"$1, engaging surface threat.",
|
||||
"$1, rolling in on enemy position.",
|
||||
"$1, affirm, moving in on target.",
|
||||
"$1, on target, commencing attack.",
|
||||
"$1, weapons hot, engaging.",
|
||||
"$1, engaging surface threat, $2.",
|
||||
"$1, rolling in on enemy position, $2.",
|
||||
"$1, affirm, moving in on target, $2.",
|
||||
"$1, on target, commencing attack on $2.",
|
||||
"$1, weapons hot, engaging $2.",
|
||||
},
|
||||
pilotWingmanGoToMarker = {
|
||||
"$1, copy. Pushing to waypoint now.",
|
||||
@ -279,6 +279,13 @@ Library.radioMessages = {
|
||||
"Command, pass coordinates for objective $1.",
|
||||
"Command, confirm grid on objective $1."
|
||||
},
|
||||
playerWingmanEngageAirDefense = {
|
||||
"Flight, prioritize air defense, engage now.",
|
||||
"Flight, take down air defense systems.",
|
||||
"Flight, suppress air defense threats.",
|
||||
"Flight, air defense is yours, take it out.",
|
||||
"Flight, eliminate air defense positions."
|
||||
},
|
||||
playerWingmanEngageBandits = {
|
||||
"Flight, engage bandits.",
|
||||
"Flight, you're cleared hot bandits.",
|
||||
@ -286,6 +293,23 @@ Library.radioMessages = {
|
||||
"Flight, engage bandits, your discretion.",
|
||||
"Flight, you're free to engage bandits."
|
||||
},
|
||||
playerWingmanEngageGround = {
|
||||
"Flight, engage ground targets.",
|
||||
"Flight, prosecute ground targets ahead.",
|
||||
"Flight, engage all ground contacts.",
|
||||
"Flight, strike vehicle positions.",
|
||||
"Flight, take the lead on ground targets.",
|
||||
},
|
||||
playerWingmanEngageHelicopters = {
|
||||
"Flight, you're cleared to prosecute helos.",
|
||||
"Flight, engage helos at your discretion.",
|
||||
"Flight, engage rotary contacts, break when done.",
|
||||
},
|
||||
playerWingmanEngageShips = {
|
||||
"Flight, engage enemy vessels now.",
|
||||
"Flight, strike ships in your sector.",
|
||||
"Flight, take the lead on sea targets.",
|
||||
},
|
||||
playerWingmanGoToMarker = {
|
||||
"Flight, proceed to waypoint.",
|
||||
"Flight, push to the hold point now.",
|
||||
|
||||
@ -14,7 +14,12 @@ do
|
||||
TUM.wingmenTasking.commandReportContacts(nil, false, true)
|
||||
end
|
||||
|
||||
local function radioCommandEngage(attributes)
|
||||
local function radioCommandEngage(args)
|
||||
local player = world:getPlayer()
|
||||
if not player then return end
|
||||
|
||||
TUM.radio.playForAll("playerWingmanEngage"..args.radioMessageSuffix, nil, player:getCallsign(), false)
|
||||
TUM.wingmenTasking.commandEngage(args.category, args.attributes, true)
|
||||
end
|
||||
|
||||
local function radioCommandReportStatus()
|
||||
@ -56,10 +61,11 @@ do
|
||||
local rootPath = missionCommands.addSubMenu("Flight")
|
||||
|
||||
local engagePath = missionCommands.addSubMenu("Engage", rootPath)
|
||||
missionCommands.addCommand("Bandits", engagePath, radioCommandEngage, {})
|
||||
missionCommands.addCommand("Air defense", engagePath, radioCommandEngage, {})
|
||||
missionCommands.addCommand("Ground targets", engagePath, radioCommandEngage, {})
|
||||
missionCommands.addCommand("Ships", engagePath, radioCommandEngage, {})
|
||||
missionCommands.addCommand("Bandits", engagePath, radioCommandEngage, { attributes = nil, category = Group.Category.HELICOPTER, radioMessageSuffix = "Bandits" })
|
||||
missionCommands.addCommand("Helicopters", engagePath, radioCommandEngage, { attributes = nil, category = Group.Category.HELICOPTER, radioMessageSuffix = "Helicopters" })
|
||||
missionCommands.addCommand("Air defense", engagePath, radioCommandEngage, { attributes = { "Air Defence" }, category = Group.Category.GROUND, radioMessageSuffix = "AirDefense" })
|
||||
missionCommands.addCommand("Ground targets", engagePath, radioCommandEngage, { attributes = {"Tanks", "Trucks", "Artillery", "IFV", "APC"}, category = Group.Category.GROUND, radioMessageSuffix = "Ground" })
|
||||
missionCommands.addCommand("Ships", engagePath, radioCommandEngage, { attributes = nil, category = Group.Category.SHIP, radioMessageSuffix = "Ships" })
|
||||
|
||||
missionCommands.addCommand("Any contacts?", rootPath, radioCommandReportContacts, nil)
|
||||
missionCommands.addCommand("Status report", rootPath, radioCommandReportStatus, nil)
|
||||
|
||||
@ -9,6 +9,7 @@ do
|
||||
TUM.wingmenTasking.DEFAULT_MARKER_TEXT = "wingman"
|
||||
|
||||
local mapMarkerMissingWarningAlreadyDisplayed = false -- Was the "map marker missing" warning already displayed during the mission?
|
||||
local targetPointMapMarker = nil
|
||||
|
||||
local function getOrbitTaskTable(point2)
|
||||
return {
|
||||
@ -22,46 +23,77 @@ do
|
||||
}
|
||||
end
|
||||
|
||||
-- local function doWingmenCommandEngage(args)
|
||||
-- local player = world:getPlayer()
|
||||
-- if not player then return end
|
||||
function TUM.wingmenTasking.commandEngage(groupCategory, targetAttributes, delayRadioAnswer)
|
||||
delayRadioAnswer = delayRadioAnswer or false
|
||||
|
||||
-- if args.radioSuffix then
|
||||
-- TUM.radio.playForAll("playerWingmanEngage"..args.radioSuffix, { getWingmanNumberAsWord(args.index) }, player:getCallsign(), false)
|
||||
-- end
|
||||
if TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) then return end -- No wingmen in multiplayer
|
||||
|
||||
-- local wingmenCtrl = getWingmanController(args.index)
|
||||
-- if not wingmenCtrl then return end
|
||||
local wingmenCtrl = TUM.wingmen.getController()
|
||||
if not wingmenCtrl then return end
|
||||
|
||||
-- local targets = getDetectedContacts(args.index, args.attributes, args.maxRange)
|
||||
-- if not targets or #targets == 0 then
|
||||
-- TUM.radio.playForAll("pilotWingmanEngageNoTarget", { getWingmanNumberAsWord(args.index) }, getWingmanCallsign(args.index), true)
|
||||
-- return
|
||||
-- end
|
||||
local detectedContacts = TUM.wingmen.getContacts(groupCategory)
|
||||
local validTargets = {}
|
||||
for _,c in ipairs(detectedContacts) do
|
||||
local g = DCSEx.world.getGroupByID(c.id)
|
||||
if g then
|
||||
local gUnits = g:getUnits()
|
||||
for _,u in ipairs(gUnits) do
|
||||
local isValid = false
|
||||
if not targetAttributes or #targetAttributes == 0 then
|
||||
isValid = true
|
||||
else
|
||||
for _,a in ipairs(targetAttributes) do
|
||||
if u:hasAttribute(a) then
|
||||
isValid = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- local taskTable = {
|
||||
-- id = "AttackGroup",
|
||||
-- params = {
|
||||
-- groupId = DCSEx.dcs.getObjectIDAsNumber(targetGroup),
|
||||
-- }
|
||||
-- }
|
||||
-- wingmenCtrl:setTask(taskTable)
|
||||
if isValid then table.insert(validTargets, u) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- -- Rejoin back once bandit has been shot down
|
||||
-- local rejoinBackTable = {
|
||||
-- id = "Follow",
|
||||
-- params = {
|
||||
-- groupId = DCSEx.dcs.getObjectIDAsNumber(player:getGroup()),
|
||||
-- pos = { x = -100, y = 0, z = -100 },
|
||||
-- lastWptIndexFlag = false,
|
||||
-- lastWptIndex = -1
|
||||
-- }
|
||||
-- }
|
||||
-- wingmenCtrl:pushTask(rejoinBackTable)
|
||||
-- if args.radioSuffix then
|
||||
-- TUM.radio.playForAll("pilotWingmanEngage"..args.radioSuffix, { getWingmanNumberAsWord(args.index) }, getWingmanCallsign(args.index), true)
|
||||
-- end
|
||||
-- end
|
||||
if #validTargets == 0 then
|
||||
TUM.radio.playForAll("pilotWingmanEngageNoTarget", { TUM.wingmen.getFirstWingmanNumber() }, TUM.wingmen.getFirstWingmanCallsign(), true)
|
||||
return
|
||||
end
|
||||
|
||||
local wingmenPosition = DCSEx.world.getGroupCenter(TUM.wingmen.getGroup())
|
||||
|
||||
validTargets = DCSEx.dcs.getNearestObjects(wingmenPosition, validTargets, 1)
|
||||
local target = validTargets[1]
|
||||
local taskTable = {
|
||||
id = "AttackGroup",
|
||||
params = {
|
||||
groupId = DCSEx.dcs.getGroupIDAsNumber(target:getGroup()),
|
||||
}
|
||||
}
|
||||
wingmenCtrl:setTask(taskTable)
|
||||
|
||||
local targetInfo = nil
|
||||
local messageSuffix = nil
|
||||
if target:inAir() then
|
||||
messageSuffix = "Air"
|
||||
targetInfo = Library.objectNames.getGeneric(target)..", "
|
||||
targetInfo = targetInfo..DCSEx.dcs.getBRAA(target:getPoint(), wingmenPosition, true)
|
||||
else
|
||||
messageSuffix = "Surface"
|
||||
targetInfo = Library.objectNames.getGeneric(target)..", "
|
||||
targetInfo = targetInfo..DCSEx.dcs.getBRAA(target:getPoint(), wingmenPosition, false)
|
||||
end
|
||||
|
||||
if targetPointMapMarker then
|
||||
trigger.action.removeMark(targetPointMapMarker)
|
||||
targetPointMapMarker = nil
|
||||
end
|
||||
|
||||
targetPointMapMarker = DCSEx.world.getNextMarkerID()
|
||||
trigger.action.markToAll(targetPointMapMarker, "Last wingmen attack point", target:getPoint(), true)
|
||||
|
||||
TUM.radio.playForAll("pilotWingmanEngage"..messageSuffix, { TUM.wingmen.getFirstWingmanNumber(), targetInfo }, TUM.wingmen.getFirstWingmanCallsign(), true)
|
||||
end
|
||||
|
||||
function TUM.wingmenTasking.commandGoToMapMarker(markerText, delayRadioAnswer)
|
||||
markerText = markerText or TUM.wingmenTasking.DEFAULT_MARKER_TEXT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user